Why the need to define a name???
Hi guys,
I need some ideas as I don't like the new model structure.
WHY do we have to always define a name for a model?
I'll put here 2 pieces of code:
Ext4:
Code:
Ext.define('someModel', {
extend: 'Ext.data.Model',
fields: ['CHARSET', 'DESCRIPTION', 'DEFAULT COLLATION']
});
var store = new Ext.data.Store({
model : 'someModel',
data : [{"CHARSET":"big5","DESCRIPTION":"Big5 Traditional Chinese","DEFAULT COLLATION":"big5_chinese_ci","MAXLEN":2},{"CHARSET":"dec8","DESCRIPTION":"DEC West European","DEFAULT COLLATION":"dec8_swedish_ci","MAXLEN":1}]
});
Ext3:
Code:
var store = new Ext.data.JsonStore({
fields: ['CHARSET', 'DESCRIPTION', 'DEFAULT COLLATION'],
data : [{"CHARSET":"big5","DESCRIPTION":"Big5 Traditional Chinese","DEFAULT COLLATION":"big5_chinese_ci","MAXLEN":2},{"CHARSET":"dec8","DESCRIPTION":"DEC West European","DEFAULT COLLATION":"dec8_swedish_ci","MAXLEN":1}]
});
At least it would be good if in the store configuration I could specify something like:
Code:
model: new Ext.data.Model({...})
but it's not working.
In my project I generate these a lot and the model is really binded to the store as the content is very dynamic.
In ext3 this worked very well, but in ext4 I always have to give a name to the model, which... imo is not so good. It's pretty static.
My workaround for the moment is generating model names with unique Id's but I don't like it.
Any suggestion is very welcomed.
Documentation needs this information
Finally. After 4 days of searching I found my answer. I am loading tabs dynamically and I need to be able to deliver the tab content as JSON so setting the model on the store/proxy was giving me hell. Now that I have removed it and instead defined my fields with the store fields property all is working.
I just wish this would be explained as a possibility in the documentation. I could have saved 3+ days.