Search code examples
phpjquerydynatree

Dynatree extra attribute


I'm using dynatree and generating my dynatree out of json. Is it possible that I've an extra attribute (data_key) in my fields so I can work with the dynatree with my PHP as well? I want a hover effect on the icons from the dynatree, the pop-up that is coming up, needs to have some data of the "hovered" node.

Somebody an answer?


Solution

  • Custom properties that you add to the JSON child array will be copied to node.data. So if you pass [{"title": "node 1", "myAttr": "foo"}, ...] you can accesss it like node.data.myAttr.