Results 1 to 8 of 8

Thread: targetNode is undefined

  1. #1
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    384

    Wink targetNode is undefined

    I have a treepanel which is embedded in a tabpanel. On the first render I get the
    message

    targetNode is undefined

    targetNode.appendChild(this.wrap); ext-all-debug.js (line 35452)

    On subsequent clicks on the treepanel I get

    uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMHTMLUListElement.appendChild]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: http://localhost/ext/ext-all-debug.js :: anonymous :: line 35452" data: no]

    There is nothing weird about the tree, and in fact it works fine in a Ext.Window

    var my_tab_panel = new Ext.tree.TreePanel({
    title:'User',
    useArrows:true,
    containerScroll:true,
    autoScroll:true,
    //animate:true,
    //enableDD:true,
    border:false,
    loader: {
    dataUrl: 'files.php',
    baseParams: {
    cmd: 'get',
    path: '/'
    }
    },
    root: {
    text: '/',
    draggable: false,
    //expanded: true,
    id:'/'
    }
    });



    but I need to put the treepanel in a tabpanel which I do using

    var tabs = new Ext.TabPanel({
    defaults : {
    autoScroll : true
    },
    activeTab: 0,
    items:[
    my_tab_panel
    ]
    });

    Any ideas? I've been stuck on this for a few weeks.

  2. #2
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    384

    Default

    It looks like it might be a render issue - ie its attempting to render the tree
    before the data is available. However - setting expand=false doesnt seem
    to fix this. I guess there is still a request being made.

    I found a similar thread in the Ext 2.x help from 2008 which unfortunately
    had no solution either - the error message was slightly different - but it
    was a tree embedded in another container.

    http://www.sencha.com/forum/showthre...-from-viewport

  3. #3

    Default

    I copied your code into its own page and did not see the error. The full HTML page is below. After loading the page, I called tabs.render(Ext.getBody()) with no errors, and I see the tab panel and the tree with one node

    Code:
    <html>
    <head>
        <link rel="stylesheet" type="text/css" href="ext-3.3.1/resources/css/ext-all.css"/>
        <script type="text/javascript" src="ext-3.3.1/adapter/ext/ext-base-debug.js"></script>
        <script type="text/javascript" src="ext-3.3.1/ext-all-debug-w-comments.js"></script>
    <script>
    
    var my_tab_panel = new Ext.tree.TreePanel({
        title:'User',
        useArrows:true,
        containerScroll:true,
        autoScroll:true,
        //animate:true,
        //enableDD:true,
        border:false,
        loader: {
        dataUrl: 'files.php',
        baseParams: {
          cmd: 'get',
          path: '/'
        }
      },
      root: {
        text: '/',
        draggable: false,
        //expanded: true,
        id:'/'
      }
    });
    var tabs = new Ext.TabPanel({
      defaults  : {
                  autoScroll : true
      },
          activeTab: 0,
              items:[
       my_tab_panel
              ]
      });
    
    </script>
    </head>
    <body></body>
    </html>

  4. #4
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    384

    Default

    Thanks for trying. I'm wondering if my php script is not delivering the right info. It works fine stand alone, but once its part of a larger app I get issues. Mmm.

  5. #5
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    384

    Default

    Agreed - I just tried the code and called it manually from the console it works OK. In my app its part of an Ext.Window and the error does occur during the render. Is there some way I can delay the automatic rendering?

  6. #6

    Default

    For TabPanel, there is a deferredRender config option...

  7. #7
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    384

    Default

    deferredRender is true by default - interestingly - if I set it to 'false' - the treepanel goes into an infinite loop continually loading the remote data.

  8. #8
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    384

    Default Fixed: targetNode is undefined

    Uugh, after trawling through masses of code - it turned out to be a stray getRootNode().expand(true) call
    in the parent window. This was effectively attempting to render the tree before the data was loaded.

Similar Threads

  1. Replies: 3
    Last Post: 9 Feb 2011, 12:34 PM
  2. this.ds is undefined
    By Komal Vaswani in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 27 Dec 2010, 3:50 AM
  3. Ext.EventObject is undefined + Ext.BoxComponent is undefined
    By rgamero in forum Ext 3.x: Help & Discussion
    Replies: 8
    Last Post: 18 May 2010, 1:33 PM
  4. oe is undefined?
    By gemsr.forever in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 7 Dec 2009, 5:46 AM
  5. targetNode has no properties if not .show()n
    By dawesi in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 11 Mar 2008, 3:26 PM

Posting Permissions

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