Skip to content

Date Picker does not seem to allow for Future Years by Default

Problem:


I have to use set_col_property for each date field on each grid. Is there a way to set it to default to current year + 10 to current year - 10?

Solution


Set the date year picker range in datepicker settings using option "yearRange".

$yearRange = <<<DATEPICKYEARRANGE
function(){
    $('.hasDatepicker').datepicker('option', 'yearRange', '2000:2050')
}
DATEPICKYEARRANGE;
$dg->add_event("jqGridAddEditAfterShowForm", $yearRange);


Feedback and Knowledge Base