I have a TreeView and an array containing ModelIndexes from that tree. The treeview's selectionMode
is set to Controls.SelectionMode.ExtendedSelection
.
Is there a way to highlight all the rows in the tree based on the indexes in the array?
I can already select just one row using
myTreeView.selection.setCurrentIndex(myindex, ItemSelectionModel.ClearAndSelect)
but I could not find a way to select/highlight multiple rows?
I found a solution. I am not sure if that is the best way, but I will post it here in case someone also looked for such thing.
myTreeView.selection.clear()
for(var j = 0; j < selectedindex.length; j++)
{
myTreeView.selection.setCurrentIndex(selectedindex[j], ItemSelectionModel.Select)
}
So the point was to use Select
as ItemSelectionModel, not ClearAndSelect
!