当前位置: 首页 > 工具软件 > jqxGrid > 使用案例 >

java服务器端分页_【原】Jqxgrid在Java服务器端分页

聂溪叠
2023-12-01

$(document).ready(function() {//prepare the data

vartheme= 'classic';varsource={

datatype:"json",

datafields: [

{ name:'CompanyName'},

{ name:'ContactName'},

{ name:'ContactTitle'},

{ name:'Address'},

{ name:'City'},

{ name:'Country'}

],

cache:false,

url:'data.php',

root:'Rows',

beforeprocessing:function(data) {

//根据实际做相应的调整不一定是data[0].TotalRows;建议写个debugger;调试

debugger;

source.totalrecords=data[0].TotalRows;

}

};vardataadapter= new$.jqx.dataAdapter(source);//initialize jqxGrid

$("#jqxgrid").jqxGrid(

{

width:600,

source: dataadapter,

theme: theme,

autoheight:true,

pageable:true,

virtualmode:true,

rendergridrows:function(params) {

//这里的返回值需要根绝实际情况作调整。如果params.data获取不到。可以用dataadapter来获取,如dataadapter.recordids[0].*等

debugger;returnparams.data;

},

columns:

[

{ text:'Company Name', datafield:'CompanyName', width:250},

{ text:'Contact Name', datafield:'ContactName', width:200},

{ text:'Contact Title', datafield:'ContactTitle', width:200},

{ text:'Address', datafield:'Address', width:180},

{ text:'City', datafield:'City', width:100},

{ text:'Country', datafield:'Country', width:140}

]

});

});

 类似资料: