Multiple Icons depending on node state

353 views
Skip to first unread message

Ray Navarette

unread,
Mar 6, 2014, 9:07:30 AM3/6/14
to jst...@googlegroups.com
Having the ability to configure multiple icons for a given type, depending on state would be an excellent addition.  The best example of this would be having a different icon for open/closed state.

I know that this has been brought up in the past and the solution put forward to use custom css selectors.  However, with the addition of now being able to describe the icon via css classes directly, I think this suggested change is more useful.  For those of us using icon libraries, like font-awesome, it would be considerably easier to just describe the class top apply rather than defining new classes and maintaining them to match the font-awesome icons.

Additionally, for others who find this: You can still work around this by using set_icon on the after_open and after_closed events, but I still think the configuration implementation would be helpful.

Thanks,
ray

Ivan Bozhanov

unread,
Mar 6, 2014, 7:33:32 PM3/6/14
to jst...@googlegroups.com
Any suggestions on how to configure this - which states should be included (loading, loaded, opened, closed, selected)? I agree it could be useful but I cannot think of a good way to configure this and a sure way to work around conflicts (using set_icon while the node has a closed state icon for example).

Ray Navarette

unread,
Mar 6, 2014, 8:08:27 PM3/6/14
to jst...@googlegroups.com
What about just simplifying the workaround and allow for a function to be used for icon? It would be passed the node as an arg after a change in the state object.

And, perhaps allow for icon = {open: 'abc', closed: 'def'} as a simplified alternative.  It's probably the most common case.


On Thursday, March 6, 2014, Ivan Bozhanov <ivan.b...@gmail.com> wrote:
Any suggestions on how to configure this - which states should be included (loading, loaded, opened, closed, selected)? I agree it could be useful but I cannot think of a good way to configure this and a sure way to work around conflicts (using set_icon while the node has a closed state icon for example).

--
You received this message because you are subscribed to a topic in the Google Groups "jsTree" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jstree/yV8VM1GMYNU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jstree+un...@googlegroups.com.
To post to this group, send email to jst...@googlegroups.com.
Visit this group at http://groups.google.com/group/jstree.
For more options, visit https://groups.google.com/d/optout.

Ivan Bozhanov

unread,
Mar 7, 2014, 4:44:17 AM3/7/14
to jst...@googlegroups.com
It is a good idea, but I will think about how to integrate this, we need to capture all use-cases without adding too much complexity.

Best regards,
Ivan


07 март 2014, петък, 03:08:27 UTC+2, Ray Navarette написа:
What about just simplifying the workaround and allow for a function to be used for icon? It would be passed the node as an arg after a change in the state object.

And, perhaps allow for icon = {open: 'abc', closed: 'def'} as a simplified alternative.  It's probably the most common case.

On Thursday, March 6, 2014, Ivan Bozhanov <ivan.b...@gmail.com> wrote:
Any suggestions on how to configure this - which states should be included (loading, loaded, opened, closed, selected)? I agree it could be useful but I cannot think of a good way to configure this and a sure way to work around conflicts (using set_icon while the node has a closed state icon for example).

--
You received this message because you are subscribed to a topic in the Google Groups "jsTree" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jstree/yV8VM1GMYNU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jstree+unsubscribe@googlegroups.com.

jplevene

unread,
Mar 7, 2014, 6:30:58 PM3/7/14
to jst...@googlegroups.com
Why not just make a simple way to change a node's icon in a function, that way the programmer can change the node as a result of an event or even from a custom state.

Ray Navarette

unread,
Mar 7, 2014, 6:47:47 PM3/7/14
to jst...@googlegroups.com
That exists as I mentioned, tree.set_icon.

This suggestion was to help with the "hooking up" part to make the customizations easier.
Reply all
Reply to author
Forward
0 new messages