1. #1
    Touch Premium Member
    Join Date
    Jun 2008
    Posts
    37
    Vote Rating
    0
    pflammer is on a distinguished road

      0  

    Default Answered: Ext.data.NodeInterface not accepting config options

    Answered: Ext.data.NodeInterface not accepting config options


    I am adding in nodes to a tree. The way I am doing this is:

    Code:
                    
    var nodeConfig = {                    leaf:true,
                        text:"some text,
                        cls:"",
                        iconCls:""
                    };
                    var treeNode = new Ext.data.NodeInterface(nodeConfig);
    But once I get treeNode, text is blank, and leaf is false. Any ideas of why that might not take? It renders that way as well (as a folder and with no text).

    Note: I used firebug to tell me what the text and leaf are after the definition. I then used an appendChild statement to the root node to add it to the tree, which is where it rendered incorrectly as well.

  2. You can't create an instance like that. NodeInterface is a decorator.

    Just pass your node config to the appendChild() method, it'll do all the work for you. If you want to create an instance yourself then it'll need to be an instance of the model that backs the store, not NodeInterface.

    If you want to see the full gory details of how this all works then take a look at the code for appendChild().

  3. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,592
    Answers
    541
    Vote Rating
    323
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    You can't create an instance like that. NodeInterface is a decorator.

    Just pass your node config to the appendChild() method, it'll do all the work for you. If you want to create an instance yourself then it'll need to be an instance of the model that backs the store, not NodeInterface.

    If you want to see the full gory details of how this all works then take a look at the code for appendChild().

  4. #3
    Touch Premium Member
    Join Date
    Jun 2008
    Posts
    37
    Vote Rating
    0
    pflammer is on a distinguished road

      0  

    Default


    Thanks. That does answer the question. The API doc was written saying to pass it an instance of an Ext.data.NodeInterface. Passing just the config did fix the issue. Thanks very much.

    The api doc was here.
    https://72.1.109.240:49324/esp/js/ext/docs/#!/api/Ext.data.NodeInterface

Thread Participants: 1