行ID在jqgrid中使用addJSONdata更改

时间:2015-02-11 15:16:07

标签: php ajax jqgrid

我通过存储的数据将数据加载到jqgrid,数据类型为jsonstring。首次加载后,我通过ajax发送滚动请求。成功的我使用

添加数据
var jsongrid = eval(data);                  
 var thegrid = $("#Grid")[0];                       
 thegrid.addJSONData(jsongrid);

它将数据添加到我的网格中,但仅使用创建网格的第一个数据进行排序。 通过这种方式添加时,网格行id更改为前缀'jqq'。如何使用每条记录的ID

创建我的行ID
$("#myGrid").jqGrid({
            datatype: "jsonstring",
            colNames:['id', 'aaa','bbb','ccc', 'ddd','eee','fff','ggg','hhh'],
            colModel:[
                    {name:'id',index:'id', hidden:true},
                    {name:'aa',index:'aa', width:200, align:'left', sorttype: 'string', sortable:true, resizable:false},
                    {name:'bb',index:'bb', width:150, align:'left', sorttype: 'string', sortable:true, resizable:false},
                    {name:'cc',index:'cc',width:90,align:"center", resizable:false, sorttype: 'int', sortable:true},
                    {name:'dd',index:'dd', hidden:true},
                    {name:'ee',index:'dd', width:100, align:'left', sorttype: 'string', sortable:true, resizable:false},        
                    {name:'ff',index:'ee', width:90, align:"center", sorttype: 'string', sortable:true, resizable:false},
                    {name:'gg',index:'gg', hidden:true},
                    {name:'hh',index:'hh', hidden:true},

            ],
            height:'530px',
            autowidth: true,
            scroll: true,
            pager: $('#myGridPager'),
            ignoreCase: true,
            //sortorder: "asc",
            gridview:true,
            loadtext: "Loading",
            emptyrecords: "No records to view",
            loadonce: false,
            loadui: 'enable',
            caption:"grid",
            datastr: $this->data,
            jsonReader: {
                repeatitems: false,
            },
            loadComplete:function(){
            },
            onPaging: function(pageButton){

                }
            },
            gridComplete: function(){
                initscroll();
                lastDiv = $("#myGrid").find(">tbody>tr.jqgrow:last").attr('id');
                celValue = $("#myGrid").jqGrid ('getCell', lastDiv, 'feedCurrentTime');
                newsTimeGrid = celValue;
               // alert(newsTimeGrid);
                $("tr.jqgrow:odd").css("background", "#F4F4F4");
                }
        });

在滚动中我使用initscroll();

调用ajax

0 个答案:

没有答案