Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Get treegrid row for refreshRow method

    How do i get the row of a node in a treegrid for passing to the refreshRow method?
    I see the indexOf method and the getRecordIndex method.
    I have tried both and keep getting a -1 returned.
    What am i doing wrong?

    here is my code:
    Code:
    <HTML>
    <HEAD>
    <script>var isomorphicDir="/isomorphic/";</script>
    <script src=/isomorphic/system/modules/ISC_Core.js></script>
    <script src=/isomorphic/system/modules/ISC_Foundation.js></script>
    <script src=/isomorphic/system/modules/ISC_Containers.js></script>
    <script src=/isomorphic/system/modules/ISC_Grids.js></script>
    <script src=/isomorphic/system/modules/ISC_Forms.js></script>
    <script src=/isomorphic/system/modules/ISC_DataBinding.js></script>
    <script src=/isomorphic/skins/SmartClient/load_skin.js></script>
    </HEAD>
    <BODY>
    <SCRIPT>
    var tree = isc.TreeGrid.create({
            ID: "employeeTree",
            width: "*",
            height: "100%",
            showResizeBar: "true",
            showOpenIcons:false,
            folderIcon:"/isomorphic/skins/SmartClient/images/TreeGrid/folder_closed.png",
            showDropIcons:false,
            showConnectors: false,
            closedIconSuffix:"",
            fields: [
              {name: "Name" },
              {name: "id" }
            ],
            data: isc.Tree.create({
                    modelType: "parent",
                    rootValue: "0",
                    nameProperty: "Name",
                    idField: "id",
                    parentIdField: "parentID",
                    data: [
                        {id:"4", parentID:"0", Name:"Charles Madigen"},
                        {id:"188", parentID:"4", Name:"Rogine Leger"},
                        {id:"189", parentID:"4", Name:"Gene Porter"},
                        {id:"265", parentID:"189", Name:"Olivier Doucet"},
                        {id:"264", parentID:"189", Name:"Cheryl Pearson"},
                        {id:"6", parentID:"4", Name: "ABCD", icon: "/isomorphic/skins/SmartClient/images/TreeGrid/folder_closed.png"}
                    ]
                })
    });
    
    isc.HLayout.create({
      ID: "mainlayout",
      height:"100%",
      width:"100%",
      layoutMargin:0,
      members:[tree,
        isc.ListGrid.create({
          ID: "agrid",
          backgroundColor: "888888", 
          width: "*",
          fields: [
            {name: "c1", title: "ID"},
            {name: "c2", title: "Name"},
            {name: "c3", title: "Description"}
          ],
          data: [
            { c1: "abc", c2: "def", c3: "ghi" },
            { c1: "dabc", c2: "adef", c3: "bghi" }
          ]
        })
      ]
    })
    
    var node = tree.data.find("id", "4");
    var newnode = {id:"5", parentID:"4", Name: "eABCD", icon: "/isomorphic/skins/SmartClient/images/TreeGrid/file.png"};
    tree.data.add(newnode, node);
    var found = tree.data.find("id", "5");
    alert(found);
    alert(tree.data.indexOf(found));
    </SCRIPT>
    </BODY>
    </HTML>
    thanks.

    #2
    Hi Derek,

    Because the tree is collapsed, that row is not visible and hence has no rowNum. If you would to add "tree.data.openAll()" right before your alert()s, you'd get a valid rowNum (6).

    Comment

    Working...
    X