Hi
I am not able to get this working in Views 7.x -3.5, I ve enable the views submodule but I can t find any settings in an exposed date filter, either on the filter or in the exposed form.

Also, in which way is this different from the Better Exposed Filter date picker (which also do not work properly) module?

Thanks

Simone

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mstrelan’s picture

There are 2 ways to create date filters in views. One is to create a filter for the specific field you want, the other is to add the generic Date filter (provided by the date_views module), which then allows you to specify the field that the filter is associated with. Not sure if that makes sense, but if it does can you check which type of filter you have? I think you'll need to use the generic date filter. Hope that helps.

cimo75’s picture

Hi
thanks yes i ve found it now still it doesn t work.

If autosubmit is off (but this doesn t make too much sense in a date picker) it works once then the date picker disappear and the normal date form is there.

If autosubmit is on, then it does not work at all, i can click on the dates but nothing happens

I hope we can make this work somehow, finally a proper way to filter dates!

Something else, a bit off topic, how can I filter a from-to date? I am only given the possibility to chose among OR or AND

Simone

mstrelan’s picture

Hi Simone,

If autosubmit is off (but this doesn t make too much sense in a date picker) it works once then the date picker disappear and the normal date form is there.

You can't really assume whether or not it make sense to have autosubmit on or off. The project that this module was built for has a series of filters, such as "event type", and using autosubmit would only let you change one filter at a time before waiting for the results to reload.

If autosubmit is on, then it does not work at all, i can click on the dates but nothing happens

Datepicker does not work with auto-submit. If you need that functionality please submit a new feature request.

Something else, a bit off topic, how can I filter a from-to date? I am only given the possibility to chose among OR or AND

You should open a new support request for this, but I'll answer it anyway. If you want two calendars, ie. to filter between 2 dates, then the final step of adding the filter should give you the option of using "between" as the operator.

Does that help?

cimo75’s picture

Hi
yes you are right about the auto-submit but I ll send a request, cause it would be better if that was functional too, there was some patching to be done in ctools to get it autosubmit with special filter widgets

Still, when I don t use auto submit it does work only one time, then the picker disappear and I am left with the date text box.

I don t want to filer among 2 dates but filter a single date (single picker) with a reference FROM - TO date field (date range)

tx
Simone

mstrelan’s picture

Still, when I don t use auto submit it does work only one time, then the picker disappear and I am left with the date text box.

Can you provide screenshots or something? I'm not experiencing the same issue. Does it disappear after hitting submit? Have you got "Use AJAX" enabled?

I don t want to filer among 2 dates but filter a single date (single picker) with a reference FROM - TO date field (date range)

Probably needs to be another feature request, although I'm not quite sure how I'd go about implementing this. I was going to suggest using http://drupal.org/project/views_filters_populate which would work quite nicely, except it only gives you a textfield.

cimo75’s picture

Hi
ok I ll post in the Date issue queue about the FROM - TO date filtering (and link here) so we don t drift away..

About this issue, a screenshot, wouldn t say too much, but yes ajax is enabled, it filters once, then it defaults back to a normal date box (as if java was disabled)

Simone

mstrelan’s picture

Title: Not working » Not working as a views filter with AJAX or Autosubmit settings enabled

Also, in which way is this different from the Better Exposed Filter date picker (which also do not work properly) module?

Datepicker is the only Drupal module I've seen that allows users to add an inline datepicker, ie. the calendar is always displayed, you don't have to click a textfield first. FWIW I just tried Better Exposed Filter and had no issue using the datepicker functionality of that module with AJAX enabled, although autosubmit doesn't work. Autosubmit seems to rely on keypresses, so clicking doesn't trigger it.

About this issue, a screenshot, wouldn t say too much, but yes ajax is enabled, it filters once, then it defaults back to a normal date box (as if java was disabled)

I can confirm this now. Disabling ajax and autosubmit should do the trick.

Patches are welcome if you want to try adding support for ajax and/or autosubmit.

cimo75’s picture

Hi
i have it in a block, I disable Ajax as you suggest and :

Exposed filters in block displays require "Use AJAX" to be set to work correctly.

That makes sense as it probaly can t access the necessary scripts in a block.

About the ajax/auto submit that s somthing that needs to addressed in Ctools, there are already a few posts about it.

Which version of Date en BEF are you using?
tx

S.

cimo75’s picture

Hi
I cna confirm that it works in a page, i see it is updating the URL but is the date picker actually using the URL to filter as an argument? That would make sense for the date picker not to work on a block. Not an expexted ajax behavior though.
S.

jberube’s picture

I have a view with AJAX enabled and when I update the filter, the view updates but the widget gets duplicated.

I was able to fix this by changing line 10 in datepicker.js

from:

  $(this).wrap('<div id="' + id + '-wrapper" />');

to:

  if (!$('#'+ id + '-wrapper').length) {
    $(this).wrap('<div id="' + id + '-wrapper" />');
  }
mstrelan’s picture

cimo75 - does #10 fix your issue?

jberube - I would prefer something like this, can you test if that works for you?

  if (!$(this).hasClass('datepicker-processed')) {
    $(this).wrap('<div id="' + id + '-wrapper" />');
    $(this).addClass('datepicker-processed');
  }
cimo75’s picture

No, none of the 2 solutions work for me :(
S.

RAFA3L’s picture

Any news?

Would be nice get it to work like this

http://www.imamuseum.org/calendar

hoter’s picture

As I understand auto submit doesn't work because datepicker not trigger an event "keyup" for a textfield. I attached a patch that fixed this issue for me.

hoter’s picture

lauriii’s picture

Status: Active » Needs review
FileSize
1.44 KB

I did some mino fixes; created the patch in the module folder and made selected date as default date.

Anonymous’s picture

The Drupal.ajax.prototype.commands.settings bit causes a javascript error for me. I removed it from my patch and everything works as expected. What does it do?
Also, when I enable AJAX even with the patch (from lauriii), pressing the dates doesn't work. I only get an error Uncaught TypeError: Cannot read property 'top' of undefined in ajax_view.js.

  • mstrelan authored 0a71c08 on 7.x-1.x
    Issue #1779960 by hoter, lauriii, mstrelan: Not working as a views...
mstrelan’s picture

Status: Needs review » Fixed

Have committed a fix for this to dev. Please re-open if it doesn't work.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.