Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
"the value of any exposed filter of the view being filtered
The last option makes the exposed filter dependent on the other filter."
Can you explain how this can be done.
I have 2 exposed filters:
1 for board types and one for fin types. For both these i have created the separate entity reference views and they show only those terms that have nodes. Thank you and that works fine!!
Now after filtering by boards, can we make only those fins show up in the next exposed filter based on the filtered values of the first filter?
Thank you!
Jaya
Comment | File | Size | Author |
---|---|---|---|
#16 | MRW_pane-filtered.png | 13.77 KB | MrsWho |
#16 | MRW_view-preview.png | 8.65 KB | MrsWho |
#16 | MRW_exposed-reference-filter.png | 45.39 KB | MrsWho |
#16 | MRW_reference-filter_contextual-filter.png | 30.98 KB | MrsWho |
#12 | Schermafbeelding 2015-08-17 om 14.46.16.png | 77.73 KB | ReBa |
Comments
Comment #1
maximpodorov CreditAttribution: maximpodorov commentedYes, it's possible. Just enter the first filter identifier as "Arguments for the view" setting of the second filter (surrounded in [] brackets).
Comment #2
j4 CreditAttribution: j4 commentedHi Maxim,
Sorry for replying so late, i was trying to understand before i wrote back to you again, but am afraid I am still stuck.
So my first filter identifier is "boardtype". I am afraid i do no understand the second half of the sentence. Is this in the main view that has the exposed filters? In the contextual filters part?
Sorry for this! Thanks in advance!
Jaya
Comment #3
maximpodorov CreditAttribution: maximpodorov commentedYou have two filters: master and dependent. You need to know master filter identifier (e.g. field_master). When you configure the dependent filter (which is Views Reference Filter), you must enter [field_master] in the "Arguments for the view", and create new view which receives one argument (which will be the current value of the master field), this view must be selected in "View used to select the entities" in the dependent filter configuration.
Comment #4
maximpodorov CreditAttribution: maximpodorov commentedHave you solved your problem?
Comment #5
ReBa CreditAttribution: ReBa commentedHi,
for me, this is also somewhat sketchy on what to do exactly. I'm trying to get this dependent filter working, but it doesn't seem to work.
Following content types:
Season
Competition ( Entity reference: Season)
Matchday (Entity reference: Competition)
I made a view where I can view my matchdays with following filters:
With dependee filter "Season":
And Dependent filter "Competition"
Following is my contextual filters for the entity_reference view:
An example of my exposed filters:
The thing is when I'm looking at my entity_reference view argument I don't see anything:
Hoping to inform you enough, I would like to know whether this is a bug, or is it me that is implementing it wrong?
Thanks in advance!
Comment #6
ReBa CreditAttribution: ReBa commentedComment #7
maximpodorov CreditAttribution: maximpodorov commentedCould you check whether AJAX call is performed when the master filter is changed?
Comment #8
tistou CreditAttribution: tistou commentedHow to check whether AJAX call is performed?
I followed the instructions, but the list of options for dependent filter is not updated. Only after I press Apply button it's updated.
Comment #9
maximpodorov CreditAttribution: maximpodorov commentedUse Network tab of web development tools of your browser.
Comment #10
ReBa CreditAttribution: ReBa commentedDoes it needs an AJAX call then? My page just refreshes...
If the page gets refreshed after applying the first filter, shouldn't the second filter automatically get it's argument from the first filter?
My second filter gets "All" as argument, always.
Comment #11
maximpodorov CreditAttribution: maximpodorov commentedOh. Could you disable page reloading after changing the first filter (turn form autosubmit off)?
Comment #12
ReBa CreditAttribution: ReBa commentedThe response:
So there happens something... but only for the field_season_target_id, I don't get any responses to change the competition select box.
My form setup:
Comment #13
maximpodorov CreditAttribution: maximpodorov commentedI think everything works. What is the problem?
Comment #14
ReBa CreditAttribution: ReBa commentedThe problem is that my second (dependant) select is not being updated...
Comment #15
maximpodorov CreditAttribution: maximpodorov commentedCould you try the latest version? I fixed some bugs there.
Comment #16
MrsWho CreditAttribution: MrsWho commentedFor anyone beating their head against this same issue like I was, I found a hint in another issue: the preview screen does not show the desired behavior of these screenshots, but it DOES work on the view page itself (or pane, in my case). See screenshots below.
One note on the Contextual Filter settings for the Reference Filter View: I did not want this view (country) to show up at all unless the user had already selected the parent filter (region), hence my configuration:
WHEN THE FILTER VALUE IS NOT AVAILABLE: Display contents of "No results found"
Hide View did not work for me in this use case: it hid the view no matter what the parent filter selection. No results hid it only when a region was not selected.
If you do this, you will not see the dependent filter in the preview AT ALL due to the default checkmark "Hide filter if empty." I unchecked this item just for this screenshot just for demonstration purposes. However, for production, I will check it so that the country selector is not shown at all unless it is populated per the region selected.
Comment #17
adigunsherif CreditAttribution: adigunsherif as a volunteer commentedRead this comment with full concentration to each point mentioned if you are still having issues with this, more importantly, number 2