0

Can someone suggest me how can I highlight the last node of a tree in dojo. I tried the _onfocus() function but it isnt working. I am using dojo 1.7 version.

I want to find the last node of my tree structure based on the node id and then highlight it.

Appreciate for all your suggestions in this.

Thanks

Dojo_user
  • 281
  • 4
  • 9
  • 28

1 Answers1

0

It All depend on the store regarding how you want to get the node. but for example if you are using a memory store and the objectstoremodel like the one in the dojo documentation then you can do that to get the tree node:

tree.model.store.query({ id: WhatevertheIDYouAreLookingFor});

Then you need to use the function path, arrays is the tree path you want to select so for this example below it will highlight Nairobi the rest of the information is for dojo to find its way through the tree. please refer to this documentation

mytree.set('path', ['world', 'AF', 'KE', 'Nairobi'] )
dori naji
  • 980
  • 1
  • 16
  • 41
  • The concept is nice but this part is not working mytree.attr('path', ['world'] ). If I want to highlight world folder just for a samplecase. Can you suggest where am I getting wrong. mytree here is the tree id. – Dojo_user Dec 05 '13 at 11:00
  • mytree here is the tree widget so if your tree id is 'MYTreeId' then you need to do something like that `registry.byId('MYTreeId').set('path', ['world'] )` i can see that you are mytree.attr('path', ['world'] ) `attr` is wrong – dori naji Dec 05 '13 at 11:42
  • Did that fix your problem can you tell us what happens with you so other readers can know if my answer is correct or not. – dori naji Dec 06 '13 at 14:25