cancel
Showing results for 
Search instead for 
Did you mean: 

Reading child item values from a TreeList

SOLVED
Highlighted
Occasional Contributor

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(tableNo == undefined)
{
tableNo = 0
}
var treeListEx = Aliases["Spry"]["Main"]["LeftPanel"]["ProjectExplorer"]["tree"];
treeListEx["wChildView"](0)["wChildView"](0)["DblClickCell"](tableNo, "Column");
}

 

Basically, the code snippet here goes to my tree list and clicks the desired item with the user specified index, defaulting to 0. What I'm wanting to do, is somehow read the treelist items, and click on the one that has the name that I want to do.

 

The issue is, I'm not able to read any of the treelist items, only the focusedvalue property.

 

If anyone has any suggestions to how I can solve this issue, I would be very appreciative.


Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Occasional Contributor

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;
}

View solution in original post

3 REPLIES 3
Highlighted
Community Manager

Thank you for posting this!

 

@Wamboo  @Reshail  @tristaanogre could you take a look at this one? You might have some ideas🙂


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
Occasional Contributor

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;
}

View solution in original post

Highlighted
Community Leader

Hi, are your applications in debug mode? If so, I think you should be able to read these tree properties from a spy object.

New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Get properties of a web page element

See replies!

Compare images using the Region Checkpoint

See replies!

Compare HTML table with Excel file and correct data in Excel file

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!
Top Kudoed Authors