Why isn’t this working ???
Mysql date format : YYYY-MM-DD
$col[“title”] = “Pmaand”;
$col[“tooltip”] = “Planningsmaand”;
$col[“name”] = “planningmaand”;
$col[“width”] = “3”;
$col[“editable”] = true;
//$col[“editoptions”] = array(“size”=>20, “defaultValue” => date(“M Y”));
$str = $grid->get_dropdown_values(“SELECT planningmaand as k, DATE_FORMAT(planningmaand, ‘%b %Y’) as v FROM XXL_2020Y group by planningmaand”);
$col[“searchoptions”] = array(“value”=>”:;”.$str);
$col[“stype”] = “select-multiple”;
$col[“formatter”] = “date”;
$col[“align”] = “right”;
$col[“formatoptions”] = array(“srcformat”=>’Y-m-d’,”newformat”=>’m/Y’, “opts” => array(“changeYear” => true, “changeMonth” => true, “dateFormat”=>’yy/mm/dd’));
$col[“hidden”] = false;
$cols[] = $col;
This is just the VISUAL aspect of the date that isn’t working. The data itself is being saved to mysql database.
this is AFTER selecting a date from the datepicker with:
dateFormat : dd-mm-yyyy
afterdatepicker : 2020/10/01
after save: 01/2020 (???)
dateFormat : mm-dd-yyyy
afterdatepicker : 2020/10/01
after save: 10/2001 (???)
dateFormat : yyyy-mm-dd
afterdatepicker : 2020/10/01
after save : 04/2178 (???)
What am I doing wrong??? because the date is perfectly saved to the database. When refreshing the grid I get perfect display of : 10/2020
Also is it possible to only get a selection for MONTH YEAR only ? (I have 3 datepickers in one row)
Thanks in advance
I reviewed your issue and it seems to be a bug at JS level. However after refresh it works.
So there is a quick fix to reload data after each edit, you can set:
$opt[“reloadedit”] = true;
$g->set_options($opt);
Thanks Abu, for the quick response and quick fix. Hopefully this will be resolved in next release?
As for my other question : I currently have 3 datepickers on one row. Is it possible to change one view in that it only displays month/year selection?
Javascript :
$(function() {
$(‘.date-picker’).datepicker( {
changeMonth: true,
changeYear: true,
showButtonPanel: true,
dateFormat: ‘MM yy’,
onClose: function(dateText, inst) {
$(this).datepicker(‘setDate’, new Date(inst.selectedYear, inst.selectedMonth, 1));
}
});
});
CSS :
.ui-datepicker-calendar {
display: none;
}
but when implemented it changes ALL the datepickers. How can I keep default format for the two others?
best regards,
You need to change jQuery selector from $(‘.date-picker’).datepicker(..) to the ID of the datepicker input box.