View Full Version : Extend custom components

24 Mar 2014, 9:39 AM

I am tying to organize and extend components to minimize the recurring code (and etc.).
But this "extending" is kind of annoying for me some way...

So, what is the adopted way, what is the best way to totally extend components? Is there any proper tutorial, demo or documentation, that covers "wide area" of "extending things"?

More specifically, for example (two grids, custom and extended custom):

alias: 'extended',
extend: 'Ext.grid.Panel'
alias: 'reextended',
extend: 'extended'

a.) How to add or remove in 'reextended' initComponent function columns, that are derived from 'extended'.
b.) When fires event for 'reextended', the same fires for 'extended'. How to prevent that.
c.) Same, if these 'extended' and 'reextended' where panels with sub components. How i would add or remove 'extended' items in 'reextended' initComponent?


Dejan Beciric
30 Mar 2014, 10:50 AM

Read first a tutorial about classes and extending classes:http://docs.sencha.com/touch/2.3.1/#!/guide/class_system
Answers to your questions:

a) override initComponent in your reextended class.

b) override listener in reextended and eventually return false for that function.

If you want to call extended function from reextended function, call it with this.callParent();So, in your InitComponent call this.callParent(), and columns would be initiated from reextended, and than, in function, you could add or remove columns you want.