返回的json是这样的:
[
{
"pageCount": 13,
"data": [
{
"nickName": "",
"fullName": "深圳市腾讯计算机系统有限公司",
"id": 57190,
"shortName": "腾讯"
},
{
"nickName": "",
"fullName": "腾讯(科技)深圳有限公司",
"id": 63472,
"shortName": "腾讯"
},
{
"nickName": "",
"fullName": "上海益盟软件(腾讯系互联网金融公司",
"id": 391211,
"shortName": "腾讯"
},
{
"nickName": "",
"fullName": "上海腾讯 (11个月",
"id": 419379,
"shortName": "腾讯"
},
{
"nickName": "",
"fullName": "上海腾讯(",
"id": 419380,
"shortName": "腾讯"
},
{
"nickName": "",
"fullName": "上海腾讯(10000人以上) [ 1 年2个月]",
"id": 419381,
"shortName": "腾讯"
},
{
"nickName": "",
"fullName": "上海腾讯(2年",
"id": 419382,
"shortName": "腾讯"
},
{
"nickName": "",
"fullName": "上海腾讯(500-1000人) [ 2年8个月]",
"id": 419383,
"shortName": "腾讯"
},
{
"nickName": "",
"fullName": "上海腾讯(外包)(1000-5000人) [ 10个月]",
"id": 419384,
"shortName": "腾讯"
},
{
"nickName": "",
"fullName": "上海腾讯互动娱乐",
"id": 419386,
"shortName": "腾讯"
}
],
"offset": 0,
"hasPrev": false,
"topCount": 10,
"count": 121,
"pageSize": 10,
"hasNext": true,
"currentPage": 1,
"actualPageSize": 10
}
]
你返回的数据结构不符合easyui的,easyui需要这种格式的
{"total":28,"rows":[{.....},{.......}]}
自己添加loadFilter处理成上面那种格式
$('#xxx').datagrid({
loadFilter:function(data){
return {total:data[0].count,rows:data[0].data}
},
//...............
}
自己搞好了,controller返回的json格式不对导致的,应返回成API中要求的
{"total":28,"rows":[
{"productid":"FI-SW-01","productname":"Koi","unitcost":10.00,"status":"P","listprice":36.50,"attr1":"Large","itemid":"EST-1"},
{"productid":"K9-DL-01","productname":"Dalmation","unitcost":12.00,"status":"P","listprice":18.50,"attr1":"Spotted Adult Female","itemid":"EST-10"},
{"productid":"RP-SN-01","productname":"Rattlesnake","unitcost":12.00,"status":"P","listprice":38.50,"attr1":"Venomless","itemid":"EST-11"},
{"productid":"RP-SN-01","productname":"Rattlesnake","unitcost":12.00,"status":"P","listprice":26.50,"attr1":"Rattleless","itemid":"EST-12"},
{"productid":"RP-LI-02","productname":"Iguana","unitcost":12.00,"status":"P","listprice":35.50,"attr1":"Green Adult","itemid":"EST-13"},
{"productid":"FL-DSH-01","productname":"Manx","unitcost":12.00,"status":"P","listprice":158.50,"attr1":"Tailless","itemid":"EST-14"},
{"productid":"FL-DSH-01","productname":"Manx","unitcost":12.00,"status":"P","listprice":83.50,"attr1":"With tail","itemid":"EST-15"},
{"productid":"FL-DLH-02","productname":"Persian","unitcost":12.00,"status":"P","listprice":23.50,"attr1":"Adult Female","itemid":"EST-16"},
{"productid":"FL-DLH-02","productname":"Persian","unitcost":12.00,"status":"P","listprice":89.50,"attr1":"Adult Male","itemid":"EST-17"},
{"productid":"AV-CB-01","productname":"Amazon Parrot","unitcost":92.00,"status":"P","listprice":63.50,"attr1":"Adult Male","itemid":"EST-18"}
]}
总数total,数据装载rows里