jqGrid不显示行,仅显示总行数 [英] jqGrid not showing rows, only shows total number of rows

查看:420
本文介绍了jqGrid不显示行,仅显示总行数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到无法解决的问题.

I'm having a problem that I can't sort it out.

请先看这张图片

如您所见,我已经能够从服务器请求JSON数据.寻呼机显示有4条记录.但是记录没有显示在表中.

As you can see, I have been able to request the JSON data from server. The pager shows that there were 4 records. But the records didn't shows in the table.

这是我的JavaScript代码

This is my javascript code

jQuery("#pickFlex66").jqGrid({
    url: root + '<?=$mod?>' + '/listpicker',
    datatype: "json",
    altRows: true,
    mtype: 'POST',
    colNames:['Code','Company Name'],
    colModel:[
        {name:'company_code',index:'company_code', width:100},
        {name:'company_name',index:'company_name', width:100}
        ],
    rowNum:10,
    width: 540,
    height: 310,
    rowList:[10,20,30],
    pager: '#pagerFlex66',
    sortname: 'company_code',
    shrinkToFit: false,
    viewrecords: true,
    sortorder: "desc",
    caption:"<?=lang("users_title")?>",
    onSelectRow: function(id){

    }
});

jQuery("#pickFlex66").jqGrid('navGrid','#pagerFlex66',{edit:false,add:false,del:false,search:false});

这是我的JSON数据

{
"page": "1",
"total": 0,
"records": "4",
"rows": [{"id":"5","cell":["55-123","123"]},{"id":"3","cell":["123","IBM"]},{"id":"2","cell":["00000","BDO"]},{"id":"1","cell":["000-00","IT GROUP Inc "]}]
}

我的JavaScript是否有错误?还是在我的JSON数据中?

Is there a mistake in my javascript? Or maybe in my JSON data?

推荐答案

我同意Briguy37的观点,认为"total": 0值很奇怪,并且原因不正确.不过,jqGrid应该确实显示所有数据.

I agree with Briguy37 that the value "total": 0 is strange and of cause incorrect. Nevertheless jqGrid should do display all data.

我想您的代码部分有问题,您没有在此处发布.您如何从演示中看到您发布的代码可以阅读并显示JSON数据.

I suppose that you have the problem in the part of your code which you not posted here. How you can see from the demo the code which you posted can do read and display the JSON data.

这篇关于jqGrid不显示行,仅显示总行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆