anaP
19 Apr 2012, 10:38 PM
Hi all,
I am trying to create model and store dynamically and also a view using json.
below is the code to create store and model dynamically.
function modelFactory(name, fields) {return Ext.define(name, {
extend: 'Ext.data.Model',
config:{
fields: fields
} });
}
function storeFactory(storeName,modelName){
return Ext.define(storeName, {
extend: 'Ext.data.Store',
requires:[modelName],
config:{
model:modelName,
}
});
then I create a view from json document
modelFactory(panel.model,panel.modelFields);
storeFactory(mytaskGrid.store,panel.model);
tabPanel=viewport.insert(1,mytaskGrid);
tabPanel.setStore(tabPanelStore);
but it gives error as Uncaught TypeError: Cannot read property 'store' of undefined
Where am I going wrong?
Do I have to create instances of model and store?
If yes then how?
Thanks in advance.
I am trying to create model and store dynamically and also a view using json.
below is the code to create store and model dynamically.
function modelFactory(name, fields) {return Ext.define(name, {
extend: 'Ext.data.Model',
config:{
fields: fields
} });
}
function storeFactory(storeName,modelName){
return Ext.define(storeName, {
extend: 'Ext.data.Store',
requires:[modelName],
config:{
model:modelName,
}
});
then I create a view from json document
modelFactory(panel.model,panel.modelFields);
storeFactory(mytaskGrid.store,panel.model);
tabPanel=viewport.insert(1,mytaskGrid);
tabPanel.setStore(tabPanelStore);
but it gives error as Uncaught TypeError: Cannot read property 'store' of undefined
Where am I going wrong?
Do I have to create instances of model and store?
If yes then how?
Thanks in advance.