PDA

View Full Version : What are the implications of store.add(object) ?



Alex_42
18 Aug 2011, 2:31 AM
Are there any implications for createing a store with a model which has a
fields:[]
and then doing
store.add(jsonReturn) ?

What am I breaking?
Am I actually breaking anything? ( eg it seems to function as one would expect )

Here is more or less what my form does:



Ext.Ajax.request({
url: 'test.php', params: { query: Ext.getCmp('test').value },success: function(response){success: function(response){
var text= response.responseText;
var json = Ext.JSON.decode(text);
Ext.define('M', {
extend: 'Ext.data.Model',
fields: []//we figure these out anyways
});
var store = Ext.create('Ext.data.Store', {
storeId:'store',
model:"M",
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});
store.add(json);