javascript - Load and initialise controller dynamically in Sencha Touch -


we use extjs v4.2 , sencha touch v2.3

i'm working on project involves loading controller dynamically. works in extjs me, can't same functionality in sencha touch.

when want load controller in extjs use following syntax

    var controllerlookup = 'here.app.controller.' + controllername;      appname.app.getcontroller(controllerlookup); 

this goes server, downloads controller , calls init method.

i exact same functionality in sencha touch. reading docs syntax looks should work similarly, can't seem work. when run code in console undefined. no call server in extjs looking file. can see i'm going wrong or if it's possible in sencha touch.

thanks

with of post on sencha forums (https://www.sencha.com/forum/showthread.php?198019-how-to-load-controllers-dynamically) able work. controller loads in dynamically , calls init method

appname

the name used in ext.application when defining application in app.js or equivalent.

classpath

the full namespace controller file

function addcontrollerdynamicallyformobile(classpath, config) {     var app = appname.app.application,         config = config || {};     ext.loader.setconfig({ enabled: true });     ext.require(classpath, function() {         var controllers = app.getcontrollerinstances();         if (!controllers[classpath]) {             var controller = ext.create(classpath, ext.apply({                 application : app             }, config.options || {}));             controllers[classpath] = controller;             app.controllers.push(classpath);             controller.init();             if (config.callback) { config.callback.call((config.scope || this), config); }         }     }); }; 

calling function

var controllerlookup = 'here.app.controller.' + controllername;; addcontrollerdynamicallyformobile(controllerlookup) 

Comments

Popular posts from this blog

command line - Use qwinsta in PowerShell ISE -

java - Incorrect order of records in M-M relationship in hibernate -

Python website log in: BIG-IP can not find session information in the request -