-
22 Jun 2012 7:01 AM #1
Minifying Direct Function (in php)
Minifying Direct Function (in php)
After compressing the application using sencha build, the web page is not loading using the new compressed js file.
In the developer tools the following error is throw "Uncaught TypeError: Cannot call method 'getTreeByJurisdiction' of undefined "
The function getTreeByJurisdiction is from a PHP file for directFn directive.
Is there anything special that needs to be done for compressing a ext JS app that uses Ext direct?
-
22 Jun 2012 12:45 PM #2
This is a common pitfall; move directFn assignment from class definition to constructor. I.e.:
becomesPHP Code:Ext.define('My.Store', {
extend: 'Ext.data.Store',
proxy: {
type: 'direct',
directFn: Direct.Store.method
}
});
By the time your Store is instantiated all symbols should be resolved.PHP Code:Ext.define('My.Store', {
extend: 'Ext.data.Store',
constructor: function(config) {
var me = this;
Ext.apply(me, config);
me.proxy = {
type: 'direct',
directFn: Direct.Store.method
};
me.callParent(arguments);
}
});
Regards,
Alex.


Reply With Quote