View Full Version : MVC handling selectors with long xtype issue

21 Oct 2013, 2:35 AM
Hello all!
We are rewriting extjs 4 application from onReady way to MVC way. First, we had some large app.js files that been succesfully refactored to MVC way (/app/controller /view /model etc). Now we are trying to compile all of them into one global app.js with appropriate files in subfolders, and meet the issue with selectors assigning. Here's view sample code (I am using one controller to control some views):

Ext.define('APP.view.subfolder.AffStatTreePanel', {
extend: 'Ext.tree.Panel',
alias: 'widget.subfolder.AffStatTreePanel',
id: 'AffStatTreePanel',

and, controller code:

Ext.define('APP.controller.subfolder.mycontroller', {
extend: 'Ext.app.Controller',
views: [ 'APP.view.subfolder.AffStatTreePanel', ... ],
init: function() {
'AffStatTreePanel' : {
select: function(tree, rec) {
// here we are not calling !!!


and this selector doesn't working now, but has worked perfectly before rearranging to subfolders.
I have tried this.control 'subfolder.AffStatTreePanel' - without success. Also tried to solve using refs:

refs: [{ref: 'AffStatTreePanel', selector: 'subfolder.AffStatTreepanel'}],

refs: [{ref: 'AffStatTreePanel', selector: 'APP.view.subfolder.AffStatTreepanel'}],

but without any success. This panel succesfully creates in viewport using {xtype: 'subfolder.AffStatTreePanel'} and selector function works, when using id property: this.control '#AffStatTreePanel' but, i think, this is not mvc-way and i have some dynamically creating views, that will not work well with id.

Please help with advice on how can i choose the selector correctly now, with subfolders?

21 Oct 2013, 7:23 AM
Point is a operator for matching xtype. So both xtype and .xtype are equivalent. So you are actually trying to find component, that matches two xtypes.
I suggest underscores/dashes instead of points.

22 Oct 2013, 1:55 AM
Thank you, ettavolt, alias: 'widget.subfolder_AffStatTreePanel' looks a bit ugly, but only the way :D