dataTables:从服务器上ajax分页

来源:互联网 发布:nba2k16自建球员数据 编辑:程序博客网 时间:2024/06/07 18:24

默认服务器返回的数据示例如下:

{
    "sEcho": 3,
    "iTotalRecords": 57,
    "iTotalDisplayRecords": 57,
    "aaData": [
        [
            "Gecko",
            "Firefox 1.0",
            "Win 98+ / OSX.2+",
            "1.7",
            "A"
        ],
        [
            "Gecko",
            "Firefox 1.5",
            "Win 98+ / OSX.2+",
            "1.8",
            "A"
        ],
        ...
    ]
}
如果使用:ajax对象的json格式:
"aaData":[{"id":7,"title":"asdf","url":"///myPa=9f=6ae1bb870.txt"},{"id":9,"title":"dddd","url":"///myPage///upl=e-41=e.txt"},{"id":10,"title":" 地==顶","url":"/=f49-46ef-a0a4-e37dcc57897c.txt"}]}
aocolumns应该设置为:
  "aoColumns": [
{ "mDataProp": "id" },
{ "mDataProp": "title" }
],

请求数据无法再action获取
private int iDisplayLength
错误:public int getiDisplayLength() {
return iDisplayLength;
}
将首字母i变为大写否则无法得到iDisplayLength应该为:public int getIDisplayLength() {
return iDisplayLength;
}

0 0
原创粉丝点击