
I’d like to be able to get the path, even if a node isn’t selected. Is this a possibilty?

I’d like to be able to get the path, even if a node isn’t selected. Is this a possibilty?
You can if you know the index into the dataset where the tree view items are stored. In binding you can get any value out of a dataset by doing the follwing:{Root Container.Component.data}[0][1]The first square bracket is for the row index and second for column index.
Sorry, let me explain. What I’m looking for is to tell which folder is selected if it is highlighted. Since the selectedItem property goes to -1, it’s impossible to index it from the dataset.
We can alter the tree to accommodate this, shouldn’t be hard, I’ve made a ticket for it.
Cool! Sorry, Travis, the “hero” monicker goes back to Carl! 
A couple of things regarding the tree component:
Jordan:
Don’t count your chickens before they hatch! The time between ticket creation and ticket resolution isn’t always as quick as you might like. 
Step7:
Sorry, I wasn't on my dev pc when I posted that.
Anyway, here is the code. You can just plop in in the property change script of the standard tree:
if event.propertyName == 'selectedItem':
item = event.source.selectedItem
newIcon='Builtin/icons/16/check2.png'
event.source.data = system.dataset.updateRow(event.source.data, item, {'icon':newIcon})
All I'm trying to do is change the default icon when someone clicks on an item (I keep track of what items have been seleceted in a seperate list). When I click on the item, the designer freezes for a few minutes, but if I do a save while it's in this frozen state, it really does eventually save. But although I've waited upwards of 30 minutes, the designer never frees up again and the only way to kill it is in task manager.
[quote=“Carl.Gould”]Jordan:
Don’t count your chickens before they hatch! The time between ticket creation and ticket resolution isn’t always as quick as you might like. 
[/quote]
Oh, believe me, I know! Been there, still there!
I’ve gone away from the tree view on this project, but keeping it in mind for future ones!
Step7: The problem with that code is that it creates an event loop.
The solution would be to check and make sure that the row you’re about to update doesn’t already have that icon configured for it.
Also - the tree already has a background color property so I must have misunderstood what you wanted for #3 above.
[quote=“Carl.Gould”]Step7: The problem with that code is that it creates an event loop.
The solution would be to check and make sure that the row you’re about to update doesn’t already have that icon configured for it.[/quote]
I tried a few things and got it to work when setting the icon the first time, but hung when I wanted to toggle it. For some reason, the property change event is called twice in a row even though the value doesn’t actually change (i.e., I see 8,8,-1,8,8 when logging the selected item). I’ll have to bind the selected item to a dynamic property and key off that instead. I’ll give it a try later.
That said, how about providing a multi-select mode like you do with lists? That would solve this problem, and the tree would behave more like other tree controls.
[quote]
Also - the tree already has a background color property so I must have misunderstood what you wanted for #3 above.[/quote]
Yep, it sure does Too many late nights I guess.
Where are we on this possiblity to tell which folder is selected if it is highlighted, with the selectedItem property?
Yes, the selectedItem does tell you which row is selected. You can call tree.getSelectedItems() in code to see all of the selected items.
By the way, you can programmatically expand or collapse the tree by calling:event.source.parent.getComponent("Tree View").expandAll()
event.source.parent.getComponent("Tree View").collapseAll()
I would like to do the same, would you find the solution?