Hi Abu,
can i use dynamicaly minDate to datepicker inside add/edit form ?
when insert or edit a record i need the new record can't have date less then max(date) from grid.
using formatoptions "opts" => mindate work but it restrict mindate to search too.
if i try to bind dynamicaly mindate to datepicker in aftershowform event it work only if i remove formatter = date from colmodels.
thanks
I find how to do this
In case of someone need this functionality,
$col = array();
$col["title"] = "Date";
$col["name"] = "date";
$col["editable"] = true;
//– Recreate date formatter for edit with srcformat , newformat and minDate
$col["formatter"] = "function(cellvalue, options, rowObject){
Ndate = Date.parse(cellvalue); //– Need dateJS from http://www.datejs.com/
return $.datepicker.formatDate('dd-mm-yy', Ndate);
}";
$col["editoptions"] = array("defaultValue"=>date('d-m-Y') );
$col["editoptions"]["dataInit"] = "function(el){
$(el).datepicker({
dateFormat: 'dd-mm-yy',
minDate: new Date('2016-08-01'),// must be in yy-mm-dd
showOn: 'button'
}).css({
'width':'75%'
})
.next('button').button({
icons: {
primary: 'ui-icon-calendar'
},
text:false
}).css({
'font-size':'69%',
'margin-left':'2px'
}).attr('autocomplete', 'false');
}
";
//– Recreate date formatter for search without minDate
$col["searchoptions"]["dataInit"] = "function(el){
$(el).datepicker({
dateFormat: 'dd-mm-yy'
}).attr('autocomplete', 'false');
}
";
$cols[] = $col;