Tree in perspective, multiselect label

I need the selectionData prop’s value to be filled when selected from tree as selectionData prop’s itemPath does…
see attached screenshot job1 is passed by triggering event from onItemClicked
image

self.props.selectionData[0].value=event.label

I want the selected item’s label in selectionData Prop’s value evenif multiselection done …plz help any one
image

but I wanted to do multi selection so how the respective path’s value can be passed ? plz help

create a custom property of type array named “multiselectData”
create an OnItemClick event on the tree which adds this script

event['itemPath'] = '/'.join(map(str,event['itemPath'])) 
for index, item in enumerate(self.custom.multiselectData): 
  if item.itemPath == event.itemPath: 
    del self.custom.multiselectData[index]
    break 
  else: 
    self.custom.multiselectData.append(event) 
self.props.selection = [x.itemPath for x in self.custom.multiselectData] 
self.props.selectionData = self.custom.multiselectData 

it causes some flikker on the selection style but its the best i can think of xd
image

1 Like

Thanks for your reply…I just now found the solution and came to inform here…by giving the item’s label value to data value under items prop, the selectionData prop’s value is taking value from data(item’s prop) on its own
image

plz help me to get the list of the all the selectedItems to pass in database

hehe i guess that is better, i also thought multiselect wasnt possible on the tree guess i should have tested that first lol

anyways
best to use prepUpdate to insert into a db
https://docs.inductiveautomation.com/display/DOC81/system.db.runPrepUpdate

1 Like