jqGrid不工作onSelectRow哪个数据类型是json

时间:2012-12-03 11:44:08

标签: jquery jqgrid free-jqgrid

数据类型:'json'=> loadComplete event ok!

但onSelectRow事件不行!

数据类型:'local'=> loadComplete event ok!

和onSelectRow事件确定!

为什么!?

jquery-ui-1.9.0.custom.min.css, ui.jqgrid.css, jquery-1.8.2.js, jquery-ui-1.9.0.custom.min.js, jquery.jqGrid-4.4.1/js/jquery.jqGrid.min.js

...

=============================================== ==

jQuery("#list4").jqGrid({
      caption:"Group List",             
      url: "master/grouping/grouplist.jspx",            
      mtype: 'post',
//    datatype: "json",
      datatype: "local",
      colNames:['NUM', 'GROUP ID', 'GROUP NAME', 'DESCRIPTION'], 
      colModel:[                                
         {name:'idx',     index:'idx'},                         
         {name:'groupId', index:'groupId'},
         {name:'groupName', index:'groupName'},             
        ,{name:'groupDesc', index:'groupDesc'}                          
      ]                             
    rowNum:10,                          
    rowList:[10,20,30],
    sortname:'idx',                             
    sortorder: "ASC",                   
    onSelectRow: function(rowid, status, e) {
               alert("please do work... !!! " + rowid + "/" + status);
               // datatype is local => work~!
               // datatype is json => dose not work !@@
    }

});
    var mydata = [
        {idx:"1",groupId:"2007-10-01",groupName:"test",groupDesc:"note"},
        {idx:"2",groupId:"2007-10-01",groupName:"test",groupDesc:"note"},
        {idx:"3",groupId:"2007-10-01",groupName:"test",groupDesc:"note"},
        {idx:"4",groupId:"2007-10-01",groupName:"test",groupDesc:"note"},
        {idx:"5",groupId:"2007-10-01",groupName:"test",groupDesc:"note"},
        {idx:"6",groupId:"2007-10-01",groupName:"test",groupDesc:"note"},
                    ];
for(var i=0;i<=mydata.length;i++){
       // jQuery("#list4").jqGrid('addRowData',i+1,mydata[i]);     // do work.  just datatype:local 
    }   

0 个答案:

没有答案