Flexigrid不分页 [英] Flexigrid not paging

查看:85
本文介绍了Flexigrid不分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个jQuery flexigrid,它在第一页上显示15的项目1-10,但分页不起作用. IE.当我请求第二页时,数据保持不变.有什么想法吗?

I have a jQuery flexigrid that is displaying items 1-10 of 15 on the first page but the paging does not work. I.e. when I request the second page, the data remains the same. Any ideas?

这是配置:

$("#tblLists").flexigrid({
    url: '/lists/load/',
    dataType: 'json',
    colModel : [
        {display: 'Name', name : 'name', width : 900, sortable : true, align: 'left'},
        {display: 'Recipients', name : 'recipients', width : 200, sortable : true, align: 'left'}
        ],
    searchitems : [
        {display: 'Name', name : 'name', isdefault: true}
        ],
    sortname: "name",
    sortorder: "desc",
    usepager: true,
    title: 'Lists',
    useRp: true,
    rp: 10,
    width: 'auto',
    height: 200,
    singleSelect: true,
    onSuccess: function(){
        $('.flexigrid tr').dblclick(function(event){
            console.log($(this).attr('id').substr(3));
        });
    }, 
});

推荐答案

我猜测您的/lists/load/网址一次返回了全部12个项目. FlexiGrid不支持客户端分页(很糟糕..但它们不支持).他们希望您在服务器端实现分页.因此,如果rp为10且page = 1,则返回结果1到10.如果rp为10且page = 2,则返回结果11到20. Flexigrid将为您传递sort参数,您需要在服务器端进行排序并返回已排序的数据.

I'm guessing that your /lists/load/ url returns all 12 items at once. FlexiGrid doesn't support client side pagination ( it sucks..but they don't ). They expect you to implement pagination on the server side. So if rp is 10 and page = 1 you return results 1 to 10. If rp is 10 and page = 2 you return results 11 to 20. Same goes for sorting. Flexigrid will pass you the sort parameter and you need to sort on the server side and return sorted data.

这篇关于Flexigrid不分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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