I know that cell editing with datepicker is possible because of references here and here. However, when I click on the cell, no datepicker shows up. Below is the colModel entry for the column in question. I have datepicker UI available.
In the other examples, dataInit is not surrounded by quotes. It is in my code because the whole colModel is dynamically created by PHP during an AJAX request. I build it as an array, then json_encode it to be passed back to jqGrid. PHP's json_encode creates valid JSON, so all keys are quoted as strings. Must I remove the quotes in order for jqGrid to work properly? If so, how?
The colModel entry for a date column:
{
"editable":true,
"name":"date",
"index":"date",
"sorttype":"date",
"editrules":{"date":true},
"editoptions":{
"dataInit":"function(elem){
setTimeout(function(){
$(elem).datepicker();
},100);
}"
}
}
Here is the structure of the ajax request:
$(document).ready(function(){
$.ajax({
type: "GET",
datatype: "json",
success: function(result){
try{
//alert(result);
result = jQuery.parseJSON(result);
}catch(err){
alert("error in success json " + err);
return;
}
var colN = result.colNames;
var colM = result.colModelList;
var colD = result.colDataList;
grid.jqGrid({
datatype: 'local',
colNames:colN, //column names
colModel:colM, //column options
data:colD, //table data
editurl: 'clientArray',//changes are not sent to server
cellEdit: true,
cellsubmit: 'clientArray',
});
}
});
});
Also, I'm using jqGrid 4.0.0