Implement jqgrid cell edit datepicker

I know that editing a cell using datepicker is possible due to the links here and here . However, when I click on a cell, the date picker does not appear. The following is the colModel entry for the column in question. I have a datepicker user interface available.

In other examples, dataInit is not surrounded by quotation marks. This is in my code because the whole colModel is dynamically created by PHP during an AJAX request. I create it as an array and then json_encode pass it back to jqGrid. PHP json_encode creates valid JSON, so all keys are quoted as strings. Do I have to remove quotes for jqGrid to work properly? If so, how?

The colModel entry for the 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 ajax request structure:

$(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',
    });
   }
  });
});

, jqGrid 4.0.0

+5
1

PHP json_encode, , Zend Framework, Zend_Json_Expr ('function...') , Zend_Json:: encode ($ Var).

, , AJAX.

Pike_Grid, , .

0

All Articles