Flexigrid not paging

三世轮回 提交于 2019-12-08 03:33:11

问题


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?

Here's the config:

$("#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));
        });
    }, 
});

回答1:


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.



来源:https://stackoverflow.com/questions/11873509/flexigrid-not-paging

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!