jquery easyui 的datagrid

whynotreg 2010-10-10 08:33:17
为何Jquery easyui的DataGrid无法分页呢。我从官方网站下载的demo,datagird那个例子,添加datagird属性PageSize:5,但是丝毫不起作用啊!而我将datagird的json文件中的数据添加到30条,那个datagrid里显示了30天数据,而不是显示10天,分为3页。。。
...全文
648 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
杏花春雨江南 2011-01-01
  • 打赏
  • 举报
回复
求大神
想在重新加载的情况下 如何设置该表 列宽?
不知道如何取到列宽

$('#test').datagrid({
title:'My Title',
iconCls:'icon-save',
nowrap: false,
striped: true,
collapsible:true,
url:'datagrid_data.json',
sortName: 'code',
sortOrder: 'desc',
remoteSort: false,
idField:'code',
frozenColumns:[[
{field:'ck',checkbox:true},
{title:'code',field:'code',sortable:true}
]],
columns:[[
{title:'Base Information',colspan:3},
{field:'opt',title:'Operation',width:(width2-95)*0.20,align:'center', rowspan:2,
formatter:function(value,rec){
return '<span style="color:red" width='+(width2-95)*0.20+'>Edit Delete</span>';
}
}
],[
{field:'name',title:'Name',width:(width2-95)*0.25},
{field:'addr',title:'Address',width:(width2-95)*0.25,rowspan:2,sortable:true,
sorter:function(a,b){
return (a>b?1:-1);
}
},
{field:'col4',title:'Col41',width:(width2-95)*0.25,rowspan:2}
]],
pagination:true,
rownumbers:true,
toolbar:[{
id:'btnadd',
text:'Add',
searchItems:[{id:"searchAutName",//文本框的id
text:'权限名称',//文本标签
field:'authName',//文本框的name
size:10//文本框的长度
},{id:"searchAutName",//文本框的id
text:'权限名称',//文本标签
field:'authName',//文本框的name
size:10//文本框的长度
},{id:"searchAutName",//文本框的id
text:'权限名称',//文本标签
field:'authName',//文本框的name
size:10//文本框的长度
}],//自己手动添加的搜索文本框
iconCls:'icon-add',
handler:function(){
$('#btnsave').linkbutton('enable');
alert('add')
}
},{
id:'btncut',
text:'Cut',
iconCls:'icon-cut',
handler:function(){
$('#btnsave').linkbutton('enable');
alert('cut')
}
},'-',{
id:'btnsave',
text:'Save',
disabled:true,
iconCls:'icon-save',
handler:function(){
$('#btnsave').linkbutton('disable');
alert('save')
}
}]
});
var p = $('#test').datagrid('getPager');
if (p){
$(p).pagination({
onBeforeRefresh:function(){
alert('before refresh');
}
});
}
Go 旅城通票 2010-10-11
  • 打赏
  • 举报
回复
我的理解是这样的,不知道对不对。

jq的datagrid不是根据rows返回的数据量和pageSize进行分页的,你rows返回多少条,他就显示多少条数据。

所以你的动态页需要根据分页时传递的参数返回指定行数的数据量,你返回所有数据jq都会自动显示出来。

pageSize需要为pageList中设定的值,要不好像都会默认为10
LastJune 2010-10-11
  • 打赏
  • 举报
回复
pageSize是供返回后台数据库查询时使用的,
也就是说你在后台取得这个pageSize然后查询相应数量的记录再返回。
估计你后台没写好,可以把后台代码发出来看看。

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧