2

数据类型:'json' => loadComplete 事件好!

但是 onSelectRow 事件不行!

数据类型:'local' => loadComplete 事件好!

和 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 
    }   
4

0 回答 0