Jqgrid寻呼机问题。总记录和下一个上一个不起作用。 [英] Jqgrid pager issue. Total record and next prev dont work.

查看:69
本文介绍了Jqgrid寻呼机问题。总记录和下一个上一个不起作用。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用客户端排序实现了服务器端分页。一切正常但总记录没有正确设置在寻呼机和下一个上一个按钮不工作。



接下来,上一步按钮不活动。我根据页面从数据库中获取数据。



例如:如果我在第一页上,那么我将获得10条记录以在网格中显示等等如果用户点击下一步去下一页它将显示来自db的下一个10条记录。



但问题是下一个按钮是不可见的,总数也没有显示。



以下是我的json。



I have implemented server side paging with client side sorting. Everything works fine but Total record is not setting properly in pager and next prev button dont work.

next, prev button is not active. I get data from database according to page.

For ex : if i am on 1st page so i get 10 record to display in grid and so on if user click next to go next page it will show next 10 record from db.

But problem is next button is not visible also total is also not showing.

Following are my json .

{"total":10,"page":1,"records":100,"rows":[

{"id":0,"cell":["1","false","1","Module 1 - Title"]},
{"id":1,"cell":["2","false","1","Introduction"]},
{"id":2,"cell":["3","false","1","What is Asbestos?"]},
{"id":3,"cell":["4","false","1","Asbestos in Construction"]},
{"id":4,"cell":["5","false","1","Asbestos Materials"]},
{"id":5,"cell":["6","false","1","Health Hazards"]},
{"id":6,"cell":["7","false","1","Asbestosis"]},
{"id":7,"cell":["8","false","1","Asbestos Regulations"]},
{"id":8,"cell":["9","false","1","Ontario Regulation 278/05"]},
{"id":9,"cell":["10","false","1","Asbestos Management Program"]}
]
}





以下是我获取json到网格的方法。正确绑定GRID





and following are my method to get json to grid. GRid is bindind properly

function fn_getData() {
  $("#gvStock").jqGrid({
    url: 'jqgrid_server_side_paging.aspx?a=1',
    datatype: "json",
    loadError: function (xhr, status, error) {
      alert('load error: ' + error);
    },
    colNames: ['idtrainingeventresistrationresult', 'course_status', 'course_attempts', 'title', 'Edit', 'Delete'],
    colModel: [
                    { name: 'idtrainingeventresistrationresult', index: 'idtrainingeventresistrationresult', align: 'center', sortable: true, sorttype: 'integer' },
                { name: 'course_status', index: 'course_status', align: 'left', sortable: true, sorttype: 'text' },
                { name: 'course_attempts', index: 'course_attempts', align: 'center', sortable: true, sorttype: 'integer' },
                { name: 'title', index: 'title', align: 'center', sortable: true, sorttype: 'text' },
                { formatter: fn_Edit, align: 'left', sortable: false },
                { formatter: fn_Delete, align: 'left', sortable: false },
    ],
    loadonce: true,
    treeGridModel: 'adjacency',
    mtype: 'GET',
    loadonce: true,
    rowList: [10, 20, 30, 40, 50],
    pager: '#jQGridPager1',
    pginput: true,
    height: "auto",
    width: 930,
    rownumWidth: 20,
    rowNum: 10,
    shrinkToFit: true,
    rownumbers: false,
    viewrecords: true,
    caption: "Server side paging with client side sorting",
    gridComplete: function () {
      var recs = $("#gvStock").getGridParam("records");
      if (recs == 0 || recs == undefined) {
        $("#nd1").show();
      }
      else {
        $("#nd1").hide();
      }
    },

    loadComplete: function () {
      $("#gvStock").setGridParam({ datatype: 'local' });
      $("th.ui-th-column").css("font", "bold"); $("tr.jqgrow:odd").css("background", "#E7E7FF");
    },

    jsonReader: { repeatitems: true, root: "rows", page: "page", total: "total", records: "records", cell: "cell", id: "id", },

    onPaging : function(which_button) {
      $("#gvStock").setGridParam({ datatype: 'json' });
    }
  });
}







请建议我错在哪里。




Please suggest where i am wrong.

推荐答案

(#gvStock)。jqGrid({
url:'jqgrid_server_side_paging.aspx?a = 1',
datatype:json,
loadError:function(xhr,status,error){
alert('load error:'+ error);
},
colNames:['idtrainingeventresistrationresult','course_status' ,'course_attempts','title','Edit','Delete'],
colModel:[
{name:'idtrainingeventresistrationresult',index:'idtrainingeventresistrationresult',align:'center',sortable: true,sorttype:'integer'},
{name:'course_status',index:'course_status',align:'left',sortable:true,sorttype:'text'},
{name: 'course_attempts',index:'course_attempts',align:'center',sortable:true,sorttype:'integer'},
{name:'title',index:'title',align:'center', sortable:true,sort输入:'text'},
{formatter:fn_Edit,align:'left',sortable:false},
{formatter:fn_Delete,align:'left',sortable:false},
],
loadonce:true,
treeGridModel:'adjacency',
mtype:'GET',
loadonce:true,
rowList:[10,20, 30,40,50],
寻呼机:'#jQGridPager1',
pginput:true,
身高:自动,
宽度:930,
rownumWidth: 20,
rowNum:10,
shrinkToFit:true,
rownumbers:false,
viewrecords:true,
caption:服务器端分页与客户端排序,
gridComplete:function(){
var recs =
("#gvStock").jqGrid({ url: 'jqgrid_server_side_paging.aspx?a=1', datatype: "json", loadError: function (xhr, status, error) { alert('load error: ' + error); }, colNames: ['idtrainingeventresistrationresult', 'course_status', 'course_attempts', 'title', 'Edit', 'Delete'], colModel: [ { name: 'idtrainingeventresistrationresult', index: 'idtrainingeventresistrationresult', align: 'center', sortable: true, sorttype: 'integer' }, { name: 'course_status', index: 'course_status', align: 'left', sortable: true, sorttype: 'text' }, { name: 'course_attempts', index: 'course_attempts', align: 'center', sortable: true, sorttype: 'integer' }, { name: 'title', index: 'title', align: 'center', sortable: true, sorttype: 'text' }, { formatter: fn_Edit, align: 'left', sortable: false }, { formatter: fn_Delete, align: 'left', sortable: false }, ], loadonce: true, treeGridModel: 'adjacency', mtype: 'GET', loadonce: true, rowList: [10, 20, 30, 40, 50], pager: '#jQGridPager1', pginput: true, height: "auto", width: 930, rownumWidth: 20, rowNum: 10, shrinkToFit: true, rownumbers: false, viewrecords: true, caption: "Server side paging with client side sorting", gridComplete: function () { var recs =


(#gvStock)。getGridParam(records);
if(recs == 0 || recs == undefined){
("#gvStock").getGridParam("records"); if (recs == 0 || recs == undefined) {


(#nd1)。show();
}
else {
("#nd1").show(); } else {


这篇关于Jqgrid寻呼机问题。总记录和下一个上一个不起作用。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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