Hello
I've an issue with my pager and the date filter.
I've added an exposed date filter that is supposed to filter content by published date, displaying all the content whose published date is inferior to the parameter.
But the pager links are not working and they seems quite weird actualy:
http://mysite/aliasofpage?datepicker[value]&datepicker[default_date]=&da...
I've updated Ctools, Views and date to the latest version as well.
Here the view i recreated from scratch after having updated the modules:
$view = new view;
$view->name = 'test';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'test';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'test';
$handler->display->display_options['use_more_text'] = 'plus';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['exposed_form']['options']['reset_button_label'] = 'Réinitialiser';
$handler->display->display_options['exposed_form']['options']['exposed_sorts_label'] = 'Trier par';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '5';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['expose']['items_per_page_label'] = 'Éléments par page';
$handler->display->display_options['pager']['options']['expose']['items_per_page_options_all'] = 0;
$handler->display->display_options['pager']['options']['expose']['offset_label'] = 'Décalage';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
/* Champ: Contenu : Titre */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Critère de tri: Contenu : Date de publication */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Contenu : Publié */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Contenu : Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'publi' => 'publi',
);
/* Filter criterion: Recherche : Termes de recherche */
$handler->display->display_options['filters']['keys']['id'] = 'keys';
$handler->display->display_options['filters']['keys']['table'] = 'search_index';
$handler->display->display_options['filters']['keys']['field'] = 'keys';
$handler->display->display_options['filters']['keys']['exposed'] = TRUE;
$handler->display->display_options['filters']['keys']['expose']['operator_id'] = 'keys_op';
$handler->display->display_options['filters']['keys']['expose']['label'] = 'Termes de recherche';
$handler->display->display_options['filters']['keys']['expose']['operator'] = 'keys_op';
$handler->display->display_options['filters']['keys']['expose']['identifier'] = 'title';
$handler->display->display_options['filters']['keys']['expose']['multiple'] = FALSE;
/* Filter criterion: Date : Date (node) */
$handler->display->display_options['filters']['date_filter']['id'] = 'date_filter';
$handler->display->display_options['filters']['date_filter']['table'] = 'node';
$handler->display->display_options['filters']['date_filter']['field'] = 'date_filter';
$handler->display->display_options['filters']['date_filter']['operator'] = '<=';
$handler->display->display_options['filters']['date_filter']['exposed'] = TRUE;
$handler->display->display_options['filters']['date_filter']['expose']['operator_id'] = 'date_filter_op';
$handler->display->display_options['filters']['date_filter']['expose']['label'] = 'Par date :';
$handler->display->display_options['filters']['date_filter']['expose']['operator'] = 'date_filter_op';
$handler->display->display_options['filters']['date_filter']['expose']['identifier'] = 'datepicker';
$handler->display->display_options['filters']['date_filter']['expose']['multiple'] = FALSE;
$handler->display->display_options['filters']['date_filter']['form_type'] = 'date_text';
$handler->display->display_options['filters']['date_filter']['date_fields'] = array(
'node.created' => 'node.created',
);
$handler->display->display_options['filters']['date_filter']['date_method'] = 'AND';
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'test';
$translatables['test'] = array(
t('Master'),
t('test'),
t('plus'),
t('Appliquer'),
t('Réinitialiser'),
t('Trier par'),
t('Asc'),
t('Desc'),
t('Éléments par page'),
t('- All -'),
t('Décalage'),
t('Termes de recherche'),
t('Par date :'),
t('Page'),
);
The bugs filter works fine for first page but it bugs for the other one, be it with or without value in the date filter.
Comment | File | Size | Author |
---|---|---|---|
#23 | second content pane tab.png | 576.87 KB | Tebogo |
#23 | end of fisrt page of second content pane tab.png | 140.01 KB | Tebogo |
#23 | second page of first content pane tab on paging from second content pane.png | 585.87 KB | Tebogo |
#14 | date_filter.png | 38.2 KB | WilliamB |
#14 | View back office.png | 50.8 KB | WilliamB |
Comments
Comment #1
WilliamB CreditAttribution: WilliamB commentedI just noticed that the link are only messed up for wxhen the page first generates.
As soon as i edit the filter with value (or even if later on i remove the value) the pager links are all fine and working.
any lead on what could cause that?
It's the same in the back office btw.
Comment #2
KarlSheaConfirmed.
Comment #3
WilliamB CreditAttribution: WilliamB commentedCan i provide anything else? I've made a fix in Javascript but i would rather fix it in php.
Comment #4
KarenS CreditAttribution: KarenS commentedI can replicate the problem. The pager is not picking up the right parameters until the exposed date has been selected. I need to dig into this.
Comment #5
KarenS CreditAttribution: KarenS commentedFound a fix for this. Recent UX changes to the filter form left the default value element in the exposed form, and the Views pager then tries to add it to the back/next links. That value is not needed by the form so I removed it.
Comment #6
WilliamB CreditAttribution: WilliamB commentedKarenS are you releasing a fix or can you post the code changes you made here?
Thanks for looking into the issue eitherway !
Comment #7
StuAFCB CreditAttribution: StuAFCB commentedI'm experiencing what I think is this issue in 7.x-3.0-rc3 - has any fix been committed for this yet?
Comment #8
arlinsandbulte CreditAttribution: arlinsandbulte commented@StuAFCB: 7.x-3.0-rc3 of what? There is no 7.x-3.0-rc3 of date module.
Also, try the latest -dev code. -dev is always the latest code and where all patches are applied.
Comment #9
arlinsandbulte CreditAttribution: arlinsandbulte commentedAnd here is the commit Karen applied to fix this according to #5 above:
http://drupalcode.org/project/date.git/commit/ccb309e
Comment #11
WilliamB CreditAttribution: WilliamB commentedThanks, do i need to recreate the view for it to be taken into account?:
I've replaced my date module by the dev version as it said in the change log :
+- Issue #1271726, Keep default_value out of exposed form so it won't show up in pager.
But i get another error message;
Notice : Uninitialized string offset: 0 in date_text_element_process() (line 301 of D:\Projets\Drupal\MyProject\sites\all\modules\date\date_api\date_api_elements.inc).
I've tested and it seems there is still a problem with the pager url by default.
The pager by default to access the 2nd page is: http://mysite/actualites?datepicker[value]&title=&page=1
Which causes the error, and the error repeats as long as i dont enter another value in the date filter.
If i change it to : http://mysite/actualites?datepicker[value][date]&title=&page=1
or http://mysite/actualites?datepicker[value][date]=&title=&page=1
it works fine and as i navigate the pager is fine.
So it's just missing the [date] parameter without or without an equal after [value].
Comment #12
WilliamB CreditAttribution: WilliamB commentedComment #13
KarenS CreditAttribution: KarenS commentedThe first thing to do whenever the code is changed to fix a problem you're having with a view is to clear the caches then edit your view to see if anything needs to be changed. If there are any problems you will see error messages. Fix any problems you see. Then re-save the view, whether or not you made any changes, just to be sure it has all the latest settings.
If you still have a problem after that you will have to provide more information so we can see if this has anything to do with the problem that was supposed to be fixed. It is fixed for me and for others so I assume you will be ok after clearing your caches and editing your view.
Comment #14
WilliamB CreditAttribution: WilliamB commentedHello Karen,
I'v cleared the cache and edited the date filter criterion to see if anything changed but it didn't.
I've noticed that the latest Dev version changed the way pager url are build, they no longer contains default value etc... This was already taken into account.
I've attached a screenshot of the view configuration page: View back office.
The following Filter criteria are active:
Content: Type (= 4 - Actualités) : Filter nodes by content type "4- Actualites"
Date: Date (node) ((Contenu: Date de publication) Exposed Text Day) | Settings : The date filter that is giving me trouble, i'll detail it bellow.
Content: Published (Yes) : Only display published node
Search: Search Terms (optional ) : Allow the user to filter by term search
Content: Post date (>= -120days) : Only display node that are less than 120 days old (4months)
I've attached a screenshot of my exposed date filter:
The field is supposed to allow the user to filter and display nodes that were published before a set date.
By default the filter should take today's value (Or no value if it's the way it's going to behave when the filter is empty).
The issue i'm having now is by default the page does display the correct nodes, but when i click on the 2nd page pager link i get the following error:
Notice : Uninitialized string offset: 0 in date_text_element_process() (line 301 dans D:\mysite\sites\all\modules\date\date_api\date_api_elements.inc).
The error is due to the way the pager url is built: http://mysite/actualites?datepicker[value]&title=&page=1.
datepicker[value] should be datepicker[value][date]=.
If i make that change manualy i access the 2nd page just fine and the pager link on the 2nd page are all correctly built.
Thanks for any help you can give me. I've a temporary JS fix to edit the url, but i'm not satisfied with having to edit it client side.
Comment #15
idflood CreditAttribution: idflood commentedI'm facing the exact same issue as described by WilliamB. The view i'm using has two date filter, >= than date_start and <= than date_end with a year granularity. The pager links have the same empty attributes and finally the error is the same (line 302).
I've updated the views/date/ctools combo even if my previous date module already included the commit pointed in #9. This and a cache clear didn't fix the issue.
Here is a way to reproduce the issue with latest version of modules:
1. install drupal and modules
2. create a view from admin/structure/views/add. Give it the name "test_date" and click "Continue & edit"
3. add a filter criteria "Date: Date (node)"
4. "Date selection form element" = "Text" and in "Date field(s)" select "Content: Post date" then click "Apply and continue"
5. check "Expose this filter to visitors, to allow them to change it" and click "save"
6. save the view
7. go to "/admin/config/development/generate/content" and click generate
8. finally go to the view at "/test-date" and click on a pager link.
Comment #16
KarenS CreditAttribution: KarenS commentedThis took a while to figure out since it only affects a text widget. It turns out to be the same problem we found earlier with popup widgets. Views forces invalid but empty values into them when you use the pager for some reason so the value callback needs to be tweaked.
http://drupalcode.org/project/date.git/commit/32af797
Comment #17
WilliamB CreditAttribution: WilliamB commentedTHANK YOU very much for not giving up.
The latest commit fixed it for me!
Comment #18
WilliamB CreditAttribution: WilliamB commentedI'm facing another issue kind of related to this: http://drupal.org/node/1415306
Comment #20
rv0 CreditAttribution: rv0 commentedHaving the same issue with Date 2.5
Did something change that breaks this again?
I have an exposed filter with month and year drop down.
It is set to get "today" as value, and shows all items "greater than or equal to"
The pager link does not include todays date:
http://MYSITE/MYVIEW?date[value]&page=1
When I click the search button first, it does:
http://MYSITE/MYVIEW?date[value][year]=2012&date[value][month]=6&page=1
Comment #21
colanrv0: That must be another problem. I upgraded to 2.5 and this one got cleared up.
Comment #22
mrsimonelliott CreditAttribution: mrsimonelliott commentedI'm having exact same behavior as #20 using date 2.6 views 3.5. Problem still exists with dev versions of both modules
Comment #23
Tebogo CreditAttribution: Tebogo commentedIt seems like am experiencing almost similar problem as WilliamB, but mine seems to be paging to next page of the first content pane tab every time I page through other content panes. I have installed date module version 7.x-2.x-dev yesterday hoping that it had a fix for the bug after seeing your post.
My output is in Tabs format filtered by years from my views. All my first pages within the content pane Tabs are working fine. When I page through my first content pane Tab it still works perfect, until I start paging through to next pages of other content pane tabs, e.g. when I page to the second page of the second or third content pane it instead opens the second page of the first content pane tab.
See attached.
Is there something am doing wrong or missed out? Do I have to do something about ctools and views modules as well?
Comment #23.0
Tebogo CreditAttribution: Tebogo commentedadded link generated
Comment #24
Priti197 CreditAttribution: Priti197 commentedI am facing the same issue, if default value is set in exposed date filter pagination don't work properly. Any solution, please help!
Comment #25
aasarava CreditAttribution: aasarava commentedProblem seems to occur in date 7.x-2.7 for exposed filter w/ default value in Select mode (not Text mode). Setting View to ajax is a temporary solution.
Edit: created a separate issue: https://drupal.org/node/2195807
Comment #26
breaktheissue CreditAttribution: breaktheissue commentedI have exposed filter which searches nodes from specific content type which has taxonomy term reference as field.
I used term in exposed filter the pager is not taking these as arguments and displaying different number of results for each page, basically pager is not working on first page of results.
This is what i did and it worked.
Inside view sot criteria, select sort content with title of the node then pager works perfectly.
Thanks.
Comment #27
rahim123 CreditAttribution: rahim123 commentedOn Drupal 7.42 with 7.x-3.13 this issue still exists. I have a view with nodes that I want to allow to be OPTIONALLY filtered by "New" (unread) comments. The first page works fine, but clicking the second page enables the filter, which should be off by default, meaning that I can't view any of the next pages.
Please re-open this bug report.
Comment #28
rahim123 CreditAttribution: rahim123 commented