1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    51
    Vote Rating
    2
    tyladurdan is on a distinguished road

      0  

    Default 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.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,547
    Vote Rating
    872
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    items need to be config objects not strings
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Ext JS Premium Member smokeman's Avatar
    Join Date
    Jul 2007
    Posts
    475
    Vote Rating
    2
    smokeman is on a distinguished road

      0  

    Default


    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});
    }

Thread Participants: 2

Tags for this Thread