this is my code
var store = {
user_store: new Ext.data.Store({
autoLoad: false,
proxy: new Ext.data.HttpProxy({
url: 'a/b/c',
}),
remoteSort: true,
baseParams: {
},
reader: new Ext.data.JsonReader({
totalProperty: 'total',
root: 'root',
fields: ['roles']
})
})
};
store.user_store.load();
this is my json
{"roles":"2"}
I wnat to ask. How do I get the roles’s value is “2”.
(PS:Sorry,my English is not very well.)
If there is only one item in the response, you can add a callback function to the load method:
If the the response consist of several items like:
[{"roles":"2"},{"roles":"1"}]you can iterate the store to retrieve all values.