-
2 May 2012 1:47 PM #1
custom function in Ext.application not working after build package
custom function in Ext.application not working after build package
I need a global variable in my views and store. after searching the forum I found this solution:
and in views I use it as this:Code:Ext.application({ name: 'PhotoMoonTool', .... getSection: function() { url_args = window.location.toString().split("?"); if (url_args[1]) { url_args = Ext.Object.fromQueryString(url_args[1]); return url_args.section + '/'; } else { return ''; } } .... });
this is working, check here:Code:.... itemTpl: [ '<img src="http://www.moontools.ch/photo-moon-tool/'+ PhotoMoonTool.app.getSection() +'images/{folder_name}/{img_name}001{name_zusatz}.jpg" >' + ] ....
http://mobile.moontools.ch/photomoontool1/
and http://mobile.moontools.ch/photomoontool1/?section=manu
but if I build a webapp ("sencha app build package" or "sencha app build production") I get some errors (getSection is not defined). see here:
http://mobile.moontools.ch/package and
http://mobile.moontools.ch/production/ (this is production)
any hint how I can solve this?
thanks a lot. j
-
14 May 2012 5:29 PM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,167
- Vote Rating
- 29
That's because your classes are defined before the application actually gets instantiated. You should elevate such required methods into a utils namespace. Include that before any other classes, and it will work fine. I did this for both the SenchaCon 2011 and DiscoverMusic applications.

Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote