jqGrid 寻呼机停止工作

发布于 2024-12-07 09:04:06 字数 2865 浏览 1 评论 0原文

过去几天我一直在尝试 jqGrid 4.1.2,在此过程中激活了越来越多的内置功能。一路上寻呼机停止工作,我不知道出了什么问题。当网格加载时,我可以很好地看到第一页的数据,但是当我切换页面时,数据保持不变。只有计数器发生变化。如果我在行数下拉列表中选择 100,我可以看到所有数据。

我与 http://www.trirand.com/blog/jqgrid 中的示例进行了比较/jqgrid.html 一切似乎都匹配,但我承认我不是最好的 JavaScript 编码员。这是有问题的代码:

<script type="text/javascript" language="javascript"> 
jQuery(document).ready(function() {
    jQuery("#testgrid").jqGrid({
        url:'/Main/DynamicGridData/',
        mtype:'POST',
        datatype:'json',
        colNames: [
            'CustomerId',
            'RecordStartUtc',
            'RecordEndUtc',
            'Id',
            'Name',
            'Status',
            'AudioTitle',
            'ServerId',
            'ServerName',
            'ApplicationInstanceId',
            'ApplicationInstanceName',
            'ApplicationName',
            'ChannelId',
            'ChannelFullName',
        ],
        colModel: [
            { name: 'CustomerId', index: 'CustomerId', width: 0, align: 'left' },
            { name: 'RecordStartUtc', index: 'RecordStartUtc', width: 0, align: 'left' },
            { name: 'RecordEndUtc', index: 'RecordEndUtc', width: 0, align: 'left' },
            { name: 'Id', index: 'Id', width: 0, align: 'left' },
            { name: 'Name', index: 'Name', width: 0, align: 'left' },
            { name: 'Status', index: 'Status', width: 0, align: 'left' },
            { name: 'AudioTitle', index: 'AudioTitle', width: 0, align: 'left' },
            { name: 'ServerId', index: 'ServerId', width: 0, align: 'left' },
            { name: 'ServerName', index: 'ServerName', width: 0, align: 'left' },
            { name: 'ApplicationInstanceId', index: 'ApplicationInstanceId', width: 0, align: 'left' },
            { name: 'ApplicationInstanceName', index: 'ApplicationInstanceName', width: 0, align: 'left' },
            { name: 'ApplicationName', index: 'ApplicationName', width: 0, align: 'left' },
            { name: 'ChannelId', index: 'ChannelId', width: 0, align: 'left' },
            { name: 'ChannelFullName', index: 'ChannelFullName', width: 0, align: 'left' },
        ],
        pager:'#gridpager',
        rowNum:25,
        rowList:[25,50,75,100],
        sortname:'Id',
        sortorder:'Asc',
        viewrecords:true,
        imgpath:'/Content/themes/base/images',
        caption:'Test Grid',
        autowidth:true,
        width:'100%',
        height:'100%',
        hoverrows:false
    });
    jQuery("#testgrid").jqGrid(
        'navGrid','#gridpager',
        {view:true,edit:false,add:false,del:false},{},{},{},
        {multipleSearch:true,multipleGroup:false},{closeOnEscape:true}
    );
});

</script>

<table id="testgrid"></table>
<div id="gridpager"></div>

提前致谢, // 莱纳斯

I've been experimenting with jqGrid 4.1.2 the last couple of days, activating more and more of it's built in functionality along the way. Somewhere along the way the pager stopped working, and I cannot figure out what is wrong. When the grid loads I can see the data for the first page fine, but when I switch pages the data remains the same. Only the counter changes. If I select 100 in the number of rows dropdown-list, I can see all data.

I've compared to the examples at http://www.trirand.com/blog/jqgrid/jqgrid.html and everything seems to match, but I confess I'm not the best JavaScript coder there is. Here's the offending code:

<script type="text/javascript" language="javascript"> 
jQuery(document).ready(function() {
    jQuery("#testgrid").jqGrid({
        url:'/Main/DynamicGridData/',
        mtype:'POST',
        datatype:'json',
        colNames: [
            'CustomerId',
            'RecordStartUtc',
            'RecordEndUtc',
            'Id',
            'Name',
            'Status',
            'AudioTitle',
            'ServerId',
            'ServerName',
            'ApplicationInstanceId',
            'ApplicationInstanceName',
            'ApplicationName',
            'ChannelId',
            'ChannelFullName',
        ],
        colModel: [
            { name: 'CustomerId', index: 'CustomerId', width: 0, align: 'left' },
            { name: 'RecordStartUtc', index: 'RecordStartUtc', width: 0, align: 'left' },
            { name: 'RecordEndUtc', index: 'RecordEndUtc', width: 0, align: 'left' },
            { name: 'Id', index: 'Id', width: 0, align: 'left' },
            { name: 'Name', index: 'Name', width: 0, align: 'left' },
            { name: 'Status', index: 'Status', width: 0, align: 'left' },
            { name: 'AudioTitle', index: 'AudioTitle', width: 0, align: 'left' },
            { name: 'ServerId', index: 'ServerId', width: 0, align: 'left' },
            { name: 'ServerName', index: 'ServerName', width: 0, align: 'left' },
            { name: 'ApplicationInstanceId', index: 'ApplicationInstanceId', width: 0, align: 'left' },
            { name: 'ApplicationInstanceName', index: 'ApplicationInstanceName', width: 0, align: 'left' },
            { name: 'ApplicationName', index: 'ApplicationName', width: 0, align: 'left' },
            { name: 'ChannelId', index: 'ChannelId', width: 0, align: 'left' },
            { name: 'ChannelFullName', index: 'ChannelFullName', width: 0, align: 'left' },
        ],
        pager:'#gridpager',
        rowNum:25,
        rowList:[25,50,75,100],
        sortname:'Id',
        sortorder:'Asc',
        viewrecords:true,
        imgpath:'/Content/themes/base/images',
        caption:'Test Grid',
        autowidth:true,
        width:'100%',
        height:'100%',
        hoverrows:false
    });
    jQuery("#testgrid").jqGrid(
        'navGrid','#gridpager',
        {view:true,edit:false,add:false,del:false},{},{},{},
        {multipleSearch:true,multipleGroup:false},{closeOnEscape:true}
    );
});

</script>

<table id="testgrid"></table>
<div id="gridpager"></div>

Thanks in advance,
// Linus

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

完美的未来在梦里 2024-12-14 09:04:06

不在测试代码的地方,但尝试将“sortorder”值“Asc”更改为全部小写。

如果您正在实现服务器端分页,则添加此属性:

loadonce: false;

参考: http://www.trirand.com/jqgridwiki/doku.php ?id=wiki:options

还要在服务器端代码上测试请求是否来自第二页!

Not in a place to test your code but try changing your "sortorder" value 'Asc' to all lower case.

If you are implementing server side paging then add this property:

loadonce: false;

ref: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options

Also test on your server side code if the request is coming in for the second page at all!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文