Results 1 to 3 of 3

Thread: Variables - where to put

  1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    71
    Vote Rating
    13
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Vote Rating
    1271
      0  

    Default

    items need to be config objects not strings
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Ext JS Premium Member smokeman's Avatar
    Join Date
    Jul 2007
    Posts
    475
    Vote Rating
    2
      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});
    }

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •