Last night I found that the use of ready-made jsonstore could not meet my needs, because all the data returned from jsonstore was used for page rendering. For example, if I contained some totalcount and serverstatus attributes, isn't it impossible to map?
I think ext will not be so mentally retarded. I carefully read a reader and probably looked at its usage. The previous store can have a proxy and a reader object.
The previous store was written as follows:
VaR store = new Ext. data. jsonstore ({<br/> URL: "Servlet/statusservlet", <br/> root: "datas", <br/> fields: ["ID", "name ", "Step1", "step2", "Step3", "step4", <br/> "status"] <br/> });
Now we have written the following:
// Replace it with the form of proxy and reader to define store <br/> var proxy = new Ext. data. httpproxy ({<br/> URL: "Servlet/statusservlet" <br/>}); <br/> var reader = new Ext. data. jsonreader ({<br/> Status: "status", <br/> root: "datas", <br/> fields: [{<br/> Name: "ID" <br/>},{ <br/> name: "name" <br/>},{ <br/> Name: "Step1" <br/>},{ <br/> name: "step2" <br/>},{ <br/> Name: "Step3" <br/>},{ <br/> name: "step4" <br/>},{ <br/> Name: "status" <br/>}] <br/>}); </P> <p> var store = new Ext. data. store ({<br/> Proxy: proxy, <br/> reader: reader <br/> });
The returned data is like this:
{"Status": "2", datas: [{"ID": "1", "name": "Site 1", "Step1": "2 ", "step2": "2", "Step3": "2", "step4": "2", "status": "2" },{ "ID ": "2", "name": "Site 2", "Step1": "2", "step2": "2", "Step3": "2 ", "step4": "2", "status": "2" },{ "ID": "3", "name": "Site 3", "Step1 ": "2", "step2": "2", "Step3": "2", "step4": "2", "status": "2 "}, {"ID": "4", "name": "Site 4", "Step1": "2", "step2": "2", "Step3 ": "2", "step4": "2", "status": "2" },{ "ID": "5", "name": "site 5 ", "Step1": "2", "step2": "1", "Step3": "0", "step4": "0", "status ": "0"}]}
Using firebug to debug Ext, you can find the status value in the returned data using this method:Reader. jsondata. Status
I think there must be more efficient encapsulation methods, but now the problem has been solved and I will remember it later.