-
12 Jul 2012 9:27 AM #1
Variables - where to put
Variables - where to put
I understand that having global variables in Architect is not recommended, but I'm not sure how else to approach this.
If I have a dataview with a this.popup on itemtap, where is best to define my variables for the different youtube links that will appear on popup?
It seems that Architect ignores any variables if I place them just before adding the popup. I've also tried declaring these variables in a separate .js file but it still doesn't help.
What am I doing wrong? Here is an example with the hardcoded variable Item0 but in the console it says 'Error: [ERROR][Ext.Container#factoryItem] Invalid config, must be a valid config object'.
Here's the code:
Code:onDataviewItemTap: function(dataview, index, target, record, e, options) { console.log('Item' + index); var Item0 = '<iframe width="560" height="315" src="http://www.youtube.com/embed/lak2jahkckE" frameborder="0" allowfullscreen></iframe>'; this.popup = Ext.Viewport.add({ xtype: 'sheet', title: 'test', items: [Item0], autoRemoveOnHide : true, modal: true, ...etc.
-
18 Jul 2012 5:52 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 436
items need to be config objects not strings
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
18 Jul 2012 10:52 AM #3
I had some google maps globals I had to use, so under a launch() function for application, I simply define variables there.
Code:launch:function(){ ApplicationName.variable = x; ApplicationName.somefunction = function(){ } ApplicationName.xtemplate = new Ext.XTemplate('<a href = {link}',{compiled:true}); }


Reply With Quote