-
4 Dec 2012 2:08 AM #1
overridding Ext.form.Label seems not to work
overridding Ext.form.Label seems not to work
extjs 4.1.1 with firefox/chrom
ovverridden constructor or initComponent are not called
Code:Ext.override(Ext.form.Label, { constructor: function(cfg) { console.log('i was here'); this.callOverridden(arguments); }, initComponent: function() { console.log('i was here too'); this.callOverridden(arguments); } });
-
4 Dec 2012 2:37 AM #2
Overrides should use Ext.define:
Tested with the latest from source and I see both logs.Code:Ext.define('Foo', { override: 'Ext.form.Label', constructor: function(cfg) { console.log('i was here'); this.callOverridden(arguments); }, initComponent: function() { console.log('i was here too'); this.callOverridden(arguments); } }); Ext.require('*'); Ext.onReady(function() { new Ext.form.Label({ renderTo: document.body }); });Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
4 Dec 2012 3:59 AM #3
Many thanks.
But "Ext.define" create new "class" and override extend the existing. So they are not same.
-
4 Dec 2012 12:07 PM #4
As it goes, if I run the same code (it's functionality equivalent) it works in the latest branch as well:
The advantage of the define() syntax is it will work with dynamic loading.Code:Ext.require('*'); Ext.onReady(function() { Ext.override(Ext.form.Label, { constructor: function(cfg) { console.log('i was here'); this.callOverridden(arguments); }, initComponent: function() { console.log('i was here too'); this.callOverridden(arguments); } }); new Ext.form.Label(); });Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote