PDA

View Full Version : Calling this.getView() seems to invalidate viewConfig



gimmick66
11 Aug 2009, 5:40 AM
I'm not sure if this is a bug or not, but I ran into this oddity today. If you do something such as


var MyGrid = Ext.extend(Ext.grid.GridPanel, {
constructor: function(config){
//yadda yadda
Ext.applyIf(config, {
viewConfig: {emptyText: 'Nothing to show here!'}
});

// trouble line is here
this.getView();
}
});Calling that line looks like it invalidates your viewConfig. Normally you would do something like

this.getView().something = 'something';The emptyText (or whatever config option you set) doesn't show up. Remove that line and it does show. I'm not sure if this is a bug because the function is called in the constructor, but it seems like a valid use.

11 Aug 2009, 5:58 AM
why are you setting a property directly? Why not reconfigure?

Also, your myGrid constructor override is completely invalid

Condor
11 Aug 2009, 6:01 AM
You can't call this.getView() before you called the superclass constructor.

gimmick66
11 Aug 2009, 6:02 AM
Why? Because it's missing the superclass call? (that would be included in the yadda yadda, even if it should go at the end)

For the first question, beats me, but is it a bug?

edit: Ninja reply beat me. I see. Ok.