Forum Discussion

PrecisionDan's avatar
PrecisionDan
Occasional Contributor
5 years ago

Reading child item values from a TreeList

Hello,   I'm curious if there is any better way to go about selecting items from my TreeList object. Currently, I am usinga scipt like this one:    function OpenDataTablePanel(tableNo) { if(tab...
  • PrecisionDan's avatar
    PrecisionDan
    5 years ago

    It's a bit of an odd task, I was hoping there was some way to be able to write a piece of reusable code that I could use with most treeLists I encounter in my program. This is was I came up with so far, but my programming knowledge is limited so I may also be missing something.

     

    function GetIndexOfDataTable(name)
    {
    var treeListEx = Aliases["Spry"]["Main"]["LeftPanel"]["ProjectExplorer"]["tree"];
    var dataRoot = treeListEx["wChildView"](0);
    var data = dataRoot["wChildView"](0);
    var rowCount = data["wRowCount"];

    var indexer = 0;
    while(indexer < rowCount)
    {
    var testTable = treeListEx["wChildView"](indexer);
    data["ClickCell"](indexer,"Column");
    if(treeListEx["FocusedValue"] == name)
    {
    data["DblClickCell"](indexer,"Column");
    return indexer;
    }
    indexer = indexer + 1;
    }

    return null;
    }