-
13 Jul 2011 8:35 PM #11
hi ed, sure.
ext 3.4 version:
ext 4 version:Code:reconfigure : function(store, colModel){ var rendered = this.rendered; if(rendered){ if(this.loadMask){ this.loadMask.destroy(); this.loadMask = new Ext.LoadMask(this.bwrap, Ext.apply({}, {store:store}, this.initialConfig.loadMask)); } } if(this.view){ this.view.initData(store, colModel); } this.store = store; this.colModel = colModel; if(rendered){ this.view.refresh(true); } this.fireEvent('reconfigure', this, store, colModel); },
so, if you have a column model with:Code:reconfigure: function(store, columns) { var me = this, headerCt = me.headerCt; if (me.lockable) { me.reconfigureLockable(store, columns); } else { if (columns) { headerCt.suspendLayout = true; headerCt.removeAll(); headerCt.add(columns); } if (store) { store = Ext.StoreManager.lookup(store); me.bindStore(store); } else { me.getView().refresh(); } if (columns) { headerCt.suspendLayout = false; me.forceComponentLayout(); } } me.fireEvent('reconfigure', me); }
and want to change it toCode:defaults : { align : 'left', width : 100 }
you can still do it with applying it to each column manually, but it does not look as clean than before + it was 2 ext instances before. it is like if you would replace the first param store with the fields-array (not even the modelCode:defaults : { align : 'center', width : 200 }
).
so, to not break compatibility i suggest that you make the 2nd param optional: columns / colModel and check if it is an array or not.
best regards
tobi
-
14 Jul 2011 4:09 PM #12Sencha - Community Support Team
- Join Date
- Jan 2009
- Location
- Palo Alto, California
- Posts
- 1,941
- Vote Rating
- 6
Right, but there is no ColumnModel in 4.x - it's just an array of columns... it doesn't sound like the architecture supports what you're asking for here
Ext JS Senior Software Architect
Personal Blog: http://edspencer.net
Twitter: http://twitter.com/edspencer
Github: http://github.com/edspencer
-
15 Jul 2011 12:53 AM #13
hi ed, it does

Ext.grid.header.Container is exactly the old columnModel.
In the first releases of ext 4, it was only possible to specify an array of columns when creating a grid. Later on (beta3+, don't know for sure) it was also allowed again to set the "colModel" directly:
Ext.panel.Table:
i think it is still missing in the api docs, but works fine.Code:initComponent: function() { var me = this, scroll = me.scroll, vertical = false, horizontal = false, headerCtCfg = me.columns || me.colModel,
maybe it should also be renamed to headerCt (or headerCt back to colModel which makes more sense imho).
so, the most important point is only the reconfigure method and checking for an array or headerCt should be really easy to implement
best regards
tobias
-
15 Jul 2011 12:57 AM #14Sencha - Community Support Team
- Join Date
- Jan 2009
- Location
- Palo Alto, California
- Posts
- 1,941
- Vote Rating
- 6
Ok - if that's the case we'll do it. I asked Aaron to check out this thread
Ext JS Senior Software Architect
Personal Blog: http://edspencer.net
Twitter: http://twitter.com/edspencer
Github: http://github.com/edspencer
-
29 Jul 2011 1:45 AM #15
Hi Ed,
I've got a question related to the original problem. I have a grid whose list of columns is dynamic. So every time I change the columns in the grid I call grid.reconfigure to change the store and the list of columns. I create a new store every time the columns change, but what should I do about the model for the new store?
I see two options:
1) create a new model with a dynamically generated name each time I need a new column list. I understand that using the model is the suggested way of doing such stuff in ExtJS4, but still having so many dynamic models which are not used later seems rather silly
2) use the 'fields' property of the store, whenever creating the new store, which seems cleaner but not recommended by Sencha...
What do you think?
Thanks and best regards,
Piotr
-
29 Jul 2011 10:26 AM #16Sencha - Community Support Team
- Join Date
- Jan 2009
- Location
- Palo Alto, California
- Posts
- 1,941
- Vote Rating
- 6
Using fields in the Store is totally ok for this
Ext JS Senior Software Architect
Personal Blog: http://edspencer.net
Twitter: http://twitter.com/edspencer
Github: http://github.com/edspencer
-
31 Jul 2011 11:13 PM #17
-
22 Sep 2011 3:55 AM #18
-
23 Sep 2011 1:10 AM #19
Hi diablo,
I need also some "dynamic" models into my application.
I don't know if the following solution is the best practice, but it works :# how can you modify a the already defined model relations: i.e. adding a new field to a existent model=
So I imagine, you can also remove some field in the same manner.Code:this.fields.add('FieldName',Ext.create('Ext.data.Field',{name:'FieldName', ...}));
-
11 Nov 2011 12:30 PM #20
dynamic model for existing store
dynamic model for existing store
Hi edspencer,
I am creating store for my chart. And I have to update store's model before I am reloading the store.
Please let me know the way to do show.
I have used setModel() method to update store model but its not reflecting after store reload.
Any help appreciated.
Thanks.


Reply With Quote