Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Situation
I have a simple view outputting node in row style nodes.
It has 3 filters: node type, node published, and a date field. The date field is exposed, has a granularity "year".
Query
SELECT field_data_field_lettre_date.field_lettre_date_value AS field_data_field_lettre_date_field_lettre_date_value, node.nid AS nid
FROM
{node} node
LEFT JOIN {field_data_field_lettre_date} field_data_field_lettre_date ON node.nid = field_data_field_lettre_date.entity_id AND (field_data_field_lettre_date.entity_type = :views_join_condition_0 AND field_data_field_lettre_date.deleted = :views_join_condition_1)
WHERE (( (node.type IN ('lettre_aux_actionnaires')) AND (node.status = '1') AND (DATE_FORMAT(STR_TO_DATE(field_data_field_lettre_date.field_lettre_date_value, '%Y-%m-%dT%T'), '%Y') = '2011') ))
ORDER BY field_data_field_lettre_date_field_lettre_date_value DESC
LIMIT 10 OFFSET 0
Behavior
On the display page, everything works fine. The filter is displayed and the view filtered. On the display block, nothing is display, neither the filters nor the nodes.
If on the block display I change the filter to not be exposed it works again, and outputs nodes.
Comment | File | Size | Author |
---|---|---|---|
#22 | patch_views_exposed_filter_block_warn_users_19.patch | 992 bytes | penyaskito |
#19 | patch_views_exposed_filter_block_warn_users_19.patch | 989 bytes | mkadin |
#1 | view.txt | 16 KB | _nolocation |
Comments
Comment #1
_nolocation CreditAttribution: _nolocation commentedattached the view where this is happening.
Comment #2
gagarine CreditAttribution: gagarine commentedIs not only content of the bloc, but they are absolutely not output of the bloc at all.
Comment #3
KarenS CreditAttribution: KarenS commentedIt looks to me like no exposed filter shows up on any block. I added a taxonomy exposed filter and it does not show up on the block either. I can't see any setting in the view to alter this behavior. Maybe this is by design.
Not showing content is probably because of whatever you have as your default settings for the filter. Since you can't change the value you have whatever the default is.
Moving this to the Views module queue to see if it is intentional that there would be no exposed filters on blocks.
Comment #4
KarenS CreditAttribution: KarenS commentedTry again to move this issue....
Comment #5
esmerel CreditAttribution: esmerel commentedIs AJAX turned on? Exposed filters in blocks need it to work.
Comment #6
KarenS CreditAttribution: KarenS commentedThat was the problem. That is totally non-intuitive. There is not a clue where you mark the filter to expose it that it won't show up in a block unless you set ajax on. Even if you are configuring the filter in the block display. Neither the filter nor the Ajax configuration tell you there is a connection between the two.
If you guys think that is OK, I won't belabor the point.
Comment #8
gagarine CreditAttribution: gagarine commentedI think we should keep it open. How the hell users can know about it?
- we can switch on (without the possibility to put it off) automatically
- we can display an info message
Comment #9
merlinofchaos CreditAttribution: merlinofchaos commentedThis is the correct behavior.
blocks do not have URL paths; exposed filters need a URL path. If the exposed filter were to display (without AJAX) it would lead you to the front page. This is not desired.
Comment #10
MBroberg CreditAttribution: MBroberg commentedI got tripped up by this too. A notice would be nice. +1 for a little info message in the filter section...
Comment #11
gagarine CreditAttribution: gagarine commentedI know this is the correct behaviors but we can warn user. Please read #8.
Comment #12
dawehnerSeems to be a task
Comment #13
ximo CreditAttribution: ximo commentedIt's worth mentioning that it's not only blocks that require AJAX for exposed filters to work. Entity content (provided by the EVA module) is one example, and it took me a while to figure that out.
This is really a usability flaw, there's no way the user would know that AJAX is required for non-Page displays. A short text within the Views UI would be great, ideally below the "Expose this filter" checkbox as well as on the "Exposed form style" form. And only shown on relevant displays.
Comment #14
laroccadahouse CreditAttribution: laroccadahouse commented+2000
this issue saved my computer from the detrimental harm I was about to cause it.
Comment #15
Crell CreditAttribution: Crell commentedI was just confused by this as well, even though I've run into it before and should have remembered it. :-) UI documentation here is needed.
Comment #16
dawehnerLet's mark this as documentation task
You can use http://drupal.org/node/1115782#comment-4582214 for that
You can use $display->handler->uses_exposed() to check whether the current display has exposed forms or not and display the help text based on that. Maybe some additions to advanced help would be cool as well.
Comment #17
jvns CreditAttribution: jvns commentedComment #18
simonruffle CreditAttribution: simonruffle commentedThis issue wasted a couple of hours of my time. There is no indication of this "feature" and only this set of postings saved me. What also would have been useful to know is that you "turn AJAX on" under advanced settings
Comment #19
mkadin CreditAttribution: mkadin commentedHere's a patch...not sure if this is the best methodology...
Comment #20
mkadin CreditAttribution: mkadin commentedComment #21
tim.plunkettTriggering the testbot.
Comment #22
penyaskitoNeeds t(). Updating patch.
UPDATED: Just read Gabor's "Do not reuse a string already run through t() for watchdog() and drupal_set_message()".
Ignore the attached patch.
Comment #23
penyaskitoTriggering the testbot.
Comment #24
yeaha CreditAttribution: yeaha commentedthank you @ simonruffle ! also couldn't find the "turn ajax on button" at first
Comment #25
esmerel CreditAttribution: esmerel commentedCommited to 7.x-3.x