我想要客户端侧面分页/排序吗?在jqgrid的服务器端搜索? [英] I want cliend side pagination/sorting? search in server side in jqgrid?

查看:114
本文介绍了我想要客户端侧面分页/排序吗?在jqgrid的服务器端搜索?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望从服务器端获取客户端分页/排序和列过滤器数据.我已经使用轮询服务器端ajax调用

I want client side pagination/sorting and column filter data fetch from server side. i have use polling server side ajax call link and push the data to client side .But i change the loadonce : false to get data from server side its use full for column filter for my grid. if loadonce :true all the call's are client side sorting and paging so not able to achieve the column filter server side.

我希望使用服务器端列过滤器进行客户端分页/排序

I want client side pagination/sorting with server side column filter

请帮助我.

jQuery("#list451").jqGrid({ 
url:'getList.php?mode=result_list', 
datatype: "json",
height: 255, 
width: 600, 
colNames:['Index','Name', 'Code','Result'], 
colModel:[
{name:'item_id',index:'item_id', width:65, sorttype:'integer',searchoptions:{sopt:['eq','ne','le','lt','gt','ge']}},
{name:'item',index:'item', width:150, sorttype:'string',searchoptions:{sopt:['eq','bw','bn','cn','nc','ew','en']}},
{name:'item_cd',index:'item_cd', width:100} ,
{name:'result',index:'result', width:100,sorttype:'string',searchoptions:{sopt:['eq','ne']} ], 
rowNum:50, 
rowTotal: 200,
rowList : [20,30,50], 
loadonce:false, 
mtype: "GET", 
rownumbers: true,
rownumWidth: 40, 
gridview: true, 
pager: '#pager451', 
sortname:'item_id', 
viewrecords: true, 
sortorder: "asc", 
caption: "Loading data from server at once" });
jQuery("#list451").jqGrid('filterToolbar',{searchOperators : true});

下面的投票代码

function poll() {

var pollOutputJson;
$.ajax({

    type: "POST",
    url: server.php ? q = 5,
    contentType : "application/json; charset=utf-8",
    dataType: "json",
    async: true,
    cache: false,
    success: function (data) {
        pollOutputJson = data;
        var samGrid = jQuery("#list5");
        var su = samGrid.jqGrid('addRowData', 0, pollOutputJson);
        samGrid.setGridParam({
            rowNum: 15
        }).trigger("reloadGrid");
    },
    error: function (x, e) {
        alert("error occur");
    }
});
setTimeout((function (param) {
    return function () {
        poll();
    };
})(), 180000);
}   

推荐答案

我不想注释function poll我发现非常怀疑的代码.我只想回答关于使用loadonce: true进行客户端分页/排序的主要问题,但是要从服务器加载过滤后的数据(通过filterToolbar).

I don't want to comment function poll which code I find very suspected. I wanted just answer on your main question about usage of loadonce: true with client side pagination/sorting, but loading filtered data (by filterToolbar) from the server.

您只需要使用filterToolbarbeforeSearch回调将datatype重置为"json".

You need just use beforeSearch callback of filterToolbar to reset datatype to "json".

这篇关于我想要客户端侧面分页/排序吗?在jqgrid的服务器端搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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