Posted by tchurch on December 29, 2012 at 11:51am
17 followers
| Project: | Date |
| Version: | 7.x-2.6 |
| Component: | Views Filter |
| Category: | bug report |
| Priority: | major |
| Assigned: | Unassigned |
| Status: | needs work |
Issue Summary
I've already raised this on the Views module but they say it might be a problem with the date handlers.
#1764902: exposed grouped filter for date not working
I have an exposed "grouped" filter for a date field (field has start and end dates but I expose the start date).
I have 2 options:
- Any -
"Future Events", greater or equal to a relative date "now".
When I preview the view and test the filter, it works.
When I try it on the actual page, it's not working.
Comments
#1
Any updates? We are running a pet adoption website and we would love to have an age filter ...
#2
i don't see the input box for entering value either when using grouped exposed filter.
#3
I am also patiently waiting a fix for this,. I am not provided with a box to enter relative dates.
#4
My date filter (I made it as described on http://drupal.org/node/1764902#comment-6732320)
$handler->display->display_options['filters']['field_recall_date_value']['id'] = 'field_recall_date_value';$handler->display->display_options['filters']['field_recall_date_value']['table'] = 'field_data_field_recall_date';
$handler->display->display_options['filters']['field_recall_date_value']['field'] = 'field_recall_date_value';
$handler->display->display_options['filters']['field_recall_date_value']['operator'] = '<=';
$handler->display->display_options['filters']['field_recall_date_value']['exposed'] = TRUE;
$handler->display->display_options['filters']['field_recall_date_value']['expose']['operator_id'] = 'field_recall_date_value_op';
$handler->display->display_options['filters']['field_recall_date_value']['expose']['label'] = 'Recall date';
$handler->display->display_options['filters']['field_recall_date_value']['expose']['operator'] = 'field_recall_date_value_op';
$handler->display->display_options['filters']['field_recall_date_value']['expose']['identifier'] = 'field_recall_date_value';
$handler->display->display_options['filters']['field_recall_date_value']['is_grouped'] = TRUE;
$handler->display->display_options['filters']['field_recall_date_value']['group_info']['label'] = 'Recall date';
$handler->display->display_options['filters']['field_recall_date_value']['group_info']['identifier'] = 'field_recall_date_value';
$handler->display->display_options['filters']['field_recall_date_value']['group_info']['group_items'] = array(
1 => array(
'title' => 'Current',
'operator' => '<=',
'value' => array(
'value' => array(
'value_choose_input_type' => 'relative',
'value' => NULL,
'default_date' => 'now',
),
'min' => array(
'min_choose_input_type' => 'relative',
'min' => NULL,
'default_date' => 'now',
),
'max' => array(
'max_choose_input_type' => 'relative',
'max' => NULL,
'default_to_date' => 'now',
),
),
),
2 => array(
'title' => 'Future',
'operator' => '>',
'value' => array(
'value_group' => array(
'value_choose_input_type' => 'relative',
'value' => NULL,
'default_date' => 'now',
),
'min_group' => array(
'min_choose_input_type' => 'relative',
'min' => NULL,
'default_date' => 'now',
),
'max_group' => array(
'max_choose_input_type' => 'relative',
'max' => NULL,
'default_to_date' => 'now',
),
),
),
);
$handler->display->display_options['filters']['field_recall_date_value']['default_date'] = 'now';
Filter works in view preview only.
Group filter values from exposed filter aren't processed correctly. Attached patch fix it (it isn't very good decision, but I think maintainer will understand where bug is).
#5
#6
The last submitted patch, date_expose_group_filter.patch, failed testing.
#7
#8
The last submitted patch, date_expose_group_filter.patch, failed testing.
#9
sinn, can you explain a bit what you did and what bug you fixed ? because after i applied your patch, i still don't see the input box appear. Thanks a ton.
#10
with my patch exposed filter works not only in preview.
i didn't fix UI of settings page.
#11
if the UI wasn't fixed how were you able to enter anything in the fields ?
#12
http://drupal.org/node/1764902#comment-6732320 -> export views -> change settings -> import views.
#13
I was able to use (more or less) the same group filter as in #4, but when I needed to use this view not in preview *and* using ajax, I had to make the following modifications to the patch in #7 for it work appropriately. This patch includes the changes in #7.
#14
Check line 104 - you have changed meaning of "if" condition.
elseif (isset($this->options['expose']['identifier']) && !isset($_REQUEST[$this->options['expose']['identifier']])) {#15
i'm pretty shocked when I see this bug is still not fixed or committed by the author. And the last updated developer version was from last year.
#16
ok, maybe this has been fixed by date_views ? actually it's working without the above patch. see attached picture.
#17
@windmaomao
Two questions:
What version of date are u using ?
Did u test this with a custom date field that has a start and end date ?
My use case is for filtering events
#18
Confirm this issue with Views 3.7 and Date 2.6. Patch from #13 isn't solve the problem.
When I change manually group item type from 'offset' to 'relative' (export > change in text editor > import) - it saved correctly, but not work normally, dates are generated like date, not relative.
#19
#18 confirmed. Not fixed yet in views 3.7 and date 2.6. :-(