wice_grid icon indicating copy to clipboard operation
wice_grid copied to clipboard

Date picker year range changes

Open clubbavi opened this issue 8 years ago • 8 comments

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.

clubbavi avatar Mar 30 '16 06:03 clubbavi

no

leikind avatar Mar 30 '16 06:03 leikind

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

clubbavi avatar Mar 30 '16 07:03 clubbavi

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

leikind avatar Mar 30 '16 07:03 leikind

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.

clubbavi avatar Mar 30 '16 08:03 clubbavi

Have you tried removing DATEPICKER_YEAR_RANGE ?

leikind avatar Mar 30 '16 08:03 leikind

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.

clubbavi avatar Mar 30 '16 10:03 clubbavi

hm.. not good.

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

leikind avatar Mar 30 '16 11:03 leikind

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.

clubbavi avatar Mar 31 '16 08:03 clubbavi