Hi Abu and Community. Please could you help me with 2 simple questions? I've read the examples and other questions about this issue without a solution yet. I've the following code, and it's working, but I need that works with the datetime format d/m/Y H:i:s, including auto filter and search:
$col = array();
$col["title"] = "Data";
$col["name"] = "calldate";
$col["width"] = "15";
$col["align"] = "center";
$col["formatter"] = "datetime";
$col["formatoptions"] = array("srcformat"=>'Y-m-d H:i:s',"newformat"=>'Y/m/d H:i:s',"opts" => array("timeFormat"=>"HH:mm:ss"));
$col["searchoptions"] = array("defaultValue"=>'',"searchhidden" => true, "sopt" => array("gt","lt"));
$cols[] = $col;
$g->select_command = "SELECT uniqueid, calldate FROM cdr";
I've tried things like:
$col["formatoptions"] = array("srcformat"=>'Y-m-d H:i:s',"newformat"=>'d/m/Y H:i:s',"opts" => array("timeFormat"=>"HH:mm:ss")); //Show ok, but do not work with Auto filter and Search
$col["name"] = "datacdr";
$col["dbname"] = "date_format(calldate,'%d/%m/%Y %H:%i:%S')";
$g->select_command = "SELECT uniqueid, date_format(calldate,'%d/%m/%Y %H:%i:%S') as datacdr FROM cdr"; // Do not work
Furthermore, can I show the Datetime picker in another language instead English?, as it's working fine in the grid, with:
<script src="phpgrid/lib/js/jqgrid/js/i18n/grid.locale-pt-br" type="text/javascript"></script>
Thanks for any help.
For question #1, following should work. Emailing you updated build and demo.
$col["formatoptions"] = array("srcformat"=>'Y-m-d H:i:s',"newformat"=>'d/m/Y H:i:s',"opts" => array());
For question #2, pasting from faqs.
Q) How to change language of datepicker control (localization)?
Add following code in html head, after downloading and setting lang file path. e.g.
<script src="http://jqueryui.com/resources/demos/datepicker/datepicker-ar.js" type="text/javascript"></script>
<script>
$.datepicker.setDefaults( $.datepicker.regional[ "ar" ] );
</script>
Thanks Abu. You are the man! With the new build, I could use datetime, date and time, format, search and auto filter successfully. I downloaded the datepicker-pt-BR.js and added the code at the end of html head, then works fine:
<script src="phpgrid/lib/js/jqgrid/js/i18n/datepicker-pt-BR.js" type="text/javascript"></script>
<script>$.datepicker.setDefaults($.datepicker.regional["pt-BR"]);</script>
I've posted a new question for you. Keep the great work. Tks again.