PDA

View Full Version : [OPEN] ViewController init for modern toolkit



phimaur
29 Jul 2015, 1:15 AM
Hi there,

I am trying to setup a modern toolkit panel with a ViewController. The ViewController init method is supposed to run after the view initialization
http://docs.sencha.com/extjs/6.0/6.0.0-modern/#!/api/Ext.app.ViewController-method-init
but there is no initComponent in the toolkit and the initialize method of the view is called after the controller.

Can you please explain the lifecycle for the modern toolkit?

Thanks
Philippe

mitchellsimoens
29 Jul 2015, 4:21 AM
Different classes fire the VC's init method than does fire the initialize method. Ext.Widget fires the VC's init method but Ext.Component (which is a subclass of Ext.Widget) fires the initialize method. This is kind of odd that there are two starters for components like this. IMO Ext.Widget is touted to be a lightweight component that can be cloned/replicated quickly and so a ViewController shouldn't really be placed on it. I'm going to open an improvement for this to see what the team feels about the location of these two and to get them closer inline with the classic toolkit.

phimaur
29 Jul 2015, 10:09 PM
Thanks for your feedback.

My component is a panel which contains a list of items ( Ext.dataview.DataView for modern and Ext.view.View for classic ). The VC initializes the store and as a workaround I exposed an initView method in each view to apply it to the lists.
Do you see any drawback in this approach?