Ext数据交互的问题

来源:百度知道 编辑:UC知道 时间:2024/05/11 16:34:16
var joinerPersonalInfoDs = new Ext.data.Store({
url : '../ayule.do?method=query',
reader : new Ext.data.JsonReader({
totalProperty : 'totalCount',
root : 'root',
fields :["id", "name"]}),

-------- 后台 ------

int totalCount = dao.getalluserinfo();
JSONArray jsons = JSONArray.fromObject(personInfo, config);

try {
response.getWriter().print(
"{totalCount:"+totalCount+",root:" + jsons + "}");
} catch (IOException e) {
e.printStackTrace();
}
}

问: 是不是后台返回数据一定是 数据集的行总数,也就是int类型的count,前台才能取到数据

不需要,数据总数只是用来分页的时候用

不一定可以是string也行 但是只要返回totalCount就行了
但是分页需要有两个参数

一个是start
一个是limit

我在做这个的是继承了Ext.PagingToolbar 自己封装了一套来做的 加了些自己的功能进去
你可以看看这个类 然后再做 这样可以提高效率