Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 38

Thread: Tree without TreeLoader?

  1. #21
    Ext User
    Join Date
    Jun 2007
    Posts
    48

    Default yeah strange eh?

    I placed everything in the Ext.onReady and still the parentSandboxBridge is caught as undefined... If I place it in the body.onload same issue.
    The iframe code is located in the myRoot.htm file (at the bottom). This simply loads the ui.htm file in, and the ui.htm file contains the Ext.onReady code...

    So something is telling me the onload of the myRoot.htm (which handles setting up the parentSandbox is getting called AFTER the entire page loads including the iframe...err...I think.

    I am going to try and take the parentSandboxBridge out of the onload, and move it somewhere else in the root page to see if at least the variable gets created...this is odd.


  2. #22
    Ext User
    Join Date
    Jun 2007
    Posts
    48

    Default I should just wait to post until I test....

    Ok...in myRoot.htm I removed the code from the onLoad where the parentSandboxBridge was setup, and simply moved it below the iframe code...like so:

    was....in body.onload this function was called...

    PHP Code:
    // on load set up the Exposed object.
                // this will set up the parent sandbox for the AIR functions.
                    
    function doLoad() {
                        
                        
    // this sets the UI parentSandboxBridge object to the Exposed object we have created... (pass to IFRAME)            
                            
    document.getElementById('UI').contentWindow.parentSandboxBridge Exposed;
                        
                        
    // BRIDGE functions - to allow access to Ext framework
                        // and this will set a function from the root, to a function in the childSandbox
                        // we shall set up all of our listeners here!
                            
    window.resizeLayout             document.getElementById('UI').contentWindow.childSandboxBridge.resizeLayout;
                            
    window.loadVars                    document.getElementById('UI').contentWindow.childSandboxBridge.loadVars;
                            
    //window.renderFormWindow     = document.getElementById('UI').contentWindow.childSandboxBridge.renderFormWindow;
                        
                        // NATIVE WINDOW LISTENER
                        // now add an Event listener for checking the RESIZE event of the native window, and upon RESIZE
                        // we need to access the Ext functions in the Child layout in order to resize the layout properly.
                            
    window.addEventListener(air.NativeWindowBoundsEvent.RESIZEwindow.resizeLayout);
                            
                        
    // check if the iframe is loaded? This way we will have access to the parentSandboxBridge variable
                        // in the ui.htm space....I think.
                            
                            
                            
                    

    now....moved below the iframe...viola.

    PHP Code:

    <iframe id="UI"
                  
    onload="if (typeof this.loadCount == 'undefined') {this.loadCount = 0;} this.loadCount++; if (this.loadCount > 1) {alert('loaded')}"
                
    src="http://SomeRemoteDomain.com/ui.htm"
                
    sandboxRoot="http://SomeRemoteDomain.com/"
                
    documentRoot="app-resource:/"
                
    width="100%" 
                
    height="100%"
                
    style="border: 0px; margin: 0px; padding: 0px; width: 100%;overflow:hidden; background: #000;">
      </
    iframe>
      <
    script>
          
    // this sets the UI parentSandboxBridge object to the Exposed object we have created... (pass to IFRAME)            
                            
    document.getElementById('UI').contentWindow.parentSandboxBridge Exposed;
        
      
    </script> 
    and what do ya know....it works.

    So, now on to the menu items....hehe fire=out.

  3. #23
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Default

    You might consider something like this for use later:

    HTML Code:
    <iframe id="UI" 
                  onload="airIsReady()"   
                src="http://SomeRemoteDomain.com/ui.htm" 
                sandboxRoot="http://SomeRemoteDomain.com/" 
                documentRoot="app-resource:/" 
                width="100%"  
                height="100%" 
                style="border: 0px; margin: 0px; padding: 0px; width: 100%;overflow:hidden; background: #000;"> 
      </iframe> 
      <script> 
        var airIsReady = function(){
          // this sets the UI parentSandboxBridge object to the Exposed object we have created... (pass to IFRAME)             
                myApp.airSandBox = document.getElementById('UI').contentWindow.parentSandboxBridge = Exposed; 
        } 
      </script>
    Then you can use myApp.airSandBox anywhere you want.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  4. #24
    Ext User
    Join Date
    Jun 2007
    Posts
    48

    Default excellent

    Cool man I will def refactor most of this stuff later on down the line. Right now Im just figuring out how this AIR stuff works...

    Im still running into the looping issue with the Tree nodes. What am I supposed to return from the getTreeNodes function? A single node? an array of nodes? I tried hardcoding in the array of nodes and it just keeps looping. The response.length is 1 from your method, and it is still looping....I cant figure out what Im doing wrong....does that make sense?

    Thanks

  5. #25
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Default

    Yes, should be an array of nodes:

    PHP Code:

    [{id"\/A"text'A Folder'leaffalse,
                              
    children: [{ 
                                
    id'A\/1'
                                
    text'A child Node'
                                
    leaftrue 
                            
    }] 
    }] 
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  6. #26
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Default

    l also update the class here. It still lacked some '2.0' items.

    And i just tested it with the above JSON response. Worked fine for me.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  7. #27
    Ext User
    Join Date
    Jun 2007
    Posts
    48

    Default loop

    If I comment out the following the looping stops...

    PHP Code:
     processResponse : function(responsenodecallback){
                                  
    response = [].concat(response);
                                  
    parentSandboxBridge.trace("process response: " response.length);
                                  for(var 
    0len response.lengthleni++){
                                          
    parentSandboxBridge.trace("response:" i);
                                             var 
    this.createNode(response[i]);
                                                 if(
    n){
                                                    
    node.appendChild(n);
                                                }
                                  }
                    
    /*              
                                  if(typeof callback == "function"){
                                            callback(this, node);
                                  }*/ 
    and the nodes are not renering any text outpit either...when I uncomment that line, the loop begins and doesnt end...I have to be missing something here, but I just really am trying to figure out the login in the class....

  8. #28
    Ext User
    Join Date
    Jun 2007
    Posts
    48

    Default just saw it...

    Just saw the updated class, copied it in...and here is the code to build my tree:

    PHP Code:
            var Tree Ext.tree
        
            var 
    airLoader = new  Ext.air.TreeLoader({
                    
    baseAttrs: { checkedfalse },
                    
    requestMethod'GET',
                      
    sandBoxparentSandboxBridge.getTreeNodes //scope control
            
    });
            
            var 
    myTree = new Tree.TreePanel({
                    
    el'tree-div',
                    
    autoScrolltrue,
                    
    animatetrue,
                    
    enableDDtrue,
                    
    monitorResizetrue,
                    
    autoHeighttrue,
                    
    border:false,
                    
    containerScrolltrue,
                    
    rootVisible:true,
                    
    loaderairLoader
            
    });
                    
                    
            var 
    root = new Ext.tree.AsyncTreeNode({
                    
    text'Categories',
                    
    expanded:false,
                    
    loaderairLoader ,
                    
    draggable:false// disable root node dragging
                    
    checkedfalse
            
    });
            
            
    myTree.setRootNode(root);
            
    myTree.render();
            
    root.expand(true); 
    all it does is loop through.....


    and here is the getTreeNodes function

    PHP Code:
            function getTreeNodes(TreeLoadernode){
                
                
                   
    // based on the node selected
    /*
                    air.trace("get tree nodes:" + node.id);
                    
                var get = new air.SQLStatement();
                get.text = "SELECT * FROM `category`;";
                get.sqlConnection = db;
                get.execute();
                air.trace("category id" + get.getResult().data[0].category_id);

                return get.getResult().data;
        */        
            
    return [{id"\/A"text'A Folder'leaffalse,
                              
    children: [{ 
                                
    id'A\/1'
                                
    text'A child Node'
                                
    leaftrue 
                            
    }] 
    }]


            } 
    Last edited by trops; 29 Nov 2007 at 12:00 PM. Reason: added code.

  9. #29
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Default Lets clean up a bit.

    2.0 style:
    PHP Code:
     var Tree Ext.tree;  
                          
     var 
    myTree = new Tree.TreePanel({ 
                    
    el'tree-div'
                    
    autoScrolltrue
                    
    animatetrue
                    
    enableDDtrue
                    
    monitorResizetrue
                    
    autoHeighttrue
                    
    border:false
                    
    containerScrolltrue
                    
    rootVisible:true
                    
    loader:  new  Ext.air.TreeLoader({ baseAttrs: { checkedfalse }, 
                              
    sandBoxparentSandboxBridge.getTreeNodes }),
                    
    root:   new Ext.tree.AsyncTreeNode({ id:'categories'text'Categories'expanded:false,  draggable:falsecheckedfalse })

            }); 
                     
    myTree.getRootNode().expand(); 
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  10. #30
    Ext User
    Join Date
    Jun 2007
    Posts
    48

    Default huh?

    Now I am back to the undefined parentSandboxBridge error....this is becoming a nightmare.
    to be continued...

Page 3 of 4 FirstFirst 1234 LastLast

Posting Permissions

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