leikind / wice_grid

A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters
MIT License
535 stars 215 forks source link

Date picker year range changes #287

Open clubbavi opened 8 years ago

clubbavi commented 8 years ago

Hello,

I am currenty using wicegrid Jquery datepicker. We upgraded from wicegrid 3.0.4 to 3.6. So previously, there was no datepicker year range in the config file. So, we can select the year range as in: https://jqueryui.com/datepicker/#dropdown-month-year .

But now in 3.6, we are defining a year range as: Wice::Defaults::DATEPICKER_YEAR_RANGE = (from = Date.current.year - 10).to_s + ':' + (from + 15).to_s So it is only within a range and all years are shown as scrollable. Is there any extra configuration in that to work like the jquery year range ?

Thanks.

leikind commented 8 years ago

no

clubbavi commented 8 years ago

Can we add that feature from the previous wicegrid version in our configuration file or it was by default coming previously and not now?

leikind commented 8 years ago

I think I misunderstand you. Could you please specify clearly (1) What did you have in 3.0.4 (2) What changed? (3) What disappeared? (4) What do you want to have

clubbavi commented 8 years ago

As the jquery Datepicker in the above link: For year selection, if we select some date then automatically 10 more years is added to the year list. Same if we go in the past year as well. Currently in version 3.6 we have to add 'DATEPICKER_YEAR_RANGE' in the configuration file, so it becomes limited & all dates are visible at the same time with scrollable.

Even I added extra code to make it work: $( "#grid_f_dob_fr_date_placeholder" ).datepicker({ changeMonth: true, changeYear: true }); In this case, the picker is always visible & it behaviour is changed. In the previous version we did not do anything, bydefault it was working the jquery way.

leikind commented 8 years ago

Have you tried removing DATEPICKER_YEAR_RANGE ?

clubbavi commented 8 years ago

Yes, I am getting this error:

WiceGrid: Could not find constant DATEPICKER_YEAR_RANGE in the configuration file! It is possible that the version of WiceGrid you are using is newer than the installed configuration file in config/initializers. Constant Wice::Defaults::DATEPICKER_YEAR_RANGE is missing and you need to add it manually to wice_grid_config.rb or run the generator task=: rails g wice_grid:install

So DATEPICKER_YEAR_RANGE, we have to mention in the config file as of version 3.6.

leikind commented 8 years ago

hm.. not good.

can you try smth like $( ".hasDatepicker" ).datepicker( "option", "yearRange", "2000:2042" );

clubbavi commented 8 years ago

Sorry, for the late reply. Its the same defiining DATEPICKER_YEAR_RANGE in the config file. Just that whatever range we have mentioned in the configfile, we can ovverride it by this. I will check if I am doing anything wrong.