JsonStore 和Store实现后台取数据
等效于
注意:下面两句对应的数据是
// totalProperty: "totalProperty",
// root: "root",
[totalProperty:110,root:[{name:'唐伯虎',age:25,sex:'男'},{name:'楚留香',age:24,sex:'女'}]]
如果数据是
String _str = "[{name:'唐伯虎',age:25,sex:'男'},{name:'楚留香',age:24,sex:'女'}]"; 加上了 上面两条语句打死也不会得到数据%>_<%
一个很完美的例子 http://pepa.iteye.com/blog/249232
/* var store = new Ext.data.JsonStore({
// totalProperty: "totalProperty",
// root: "root",
url : "http://127.0.0.1:8080/extTest/getFileName",
fields : ["length", "path", "rptName","size"]
}); */
等效于
//Proxy
var proxy = new Ext.data.HttpProxy({url: "http://127.0.0.1:8080/extTest/getFileName"});
//Record 定义记录结果
var Report = Ext.data.Record.create([
{name: "path", type: "string", mapping: "path"},
{name: "length", type: "string", mapping: "length"},
{name: "rptName", type: "string", mapping: "rptName"},
{name: "size", type: "string", mapping: "size"}
]);
//Reader
var reader = new Ext.data.JsonReader({
// totalProperty: "totalProperty",
// root: "root",
},
Report
);
//Store
var store = new Ext.data.Store({
proxy: proxy,
reader: reader
});
注意:下面两句对应的数据是
// totalProperty: "totalProperty",
// root: "root",
[totalProperty:110,root:[{name:'唐伯虎',age:25,sex:'男'},{name:'楚留香',age:24,sex:'女'}]]
如果数据是
String _str = "[{name:'唐伯虎',age:25,sex:'男'},{name:'楚留香',age:24,sex:'女'}]"; 加上了 上面两条语句打死也不会得到数据%>_<%
一个很完美的例子 http://pepa.iteye.com/blog/249232