Dojo dijit tree hide expand icon

1.1k views Asked by At

I've got a dijit Tree which is populated via a store wrapped in Observable, essentially the example here: http://dojotoolkit.org/reference-guide/1.10/dijit/Tree.html#id7 (Not that the example actually runs from the dojo site though: unless that's just my browser).

It's working well and I can expand and collapse items. However, it displays an expand icon even for the last item in a hierarchy - i.e. an item that doesn't have any children. When you try and expand such an item, it seems to realise this and the expand icon then disappears.

Does anyone know of how to supress the expand icons from appearing in the first place?

Thanks!

1

There are 1 answers

1
Leftium On BEST ANSWER

Implement the mayHaveChildren() method of the model:

Implementing logic here avoids showing +/- expando icon for nodes that we know don't have children. (For efficiency reasons we may not want to check if an element actually has children until user clicks the expando node)

This method inputs one of your items and outputs true if it can be expanded; false otherwise.