Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jstree different icon for leaf nodes

Tags:

jquery

jstree

I'm using the jquery jstree component, but the problem is the inbuilt themes use the same icon for a node with children and a leaf node which isn't ideal.

How would i go about modifying the css to specify a custom icon for leaf nodes only?

Cheers.

like image 662
Nick Avatar asked Oct 15 '12 09:10

Nick


2 Answers

You want to have a look at types plugin

The types enables node types - each node can have a type, and you can define
rules on how that type should behave - maximum children count, maximum depth,
valid children types, selectable or not, etc.
like image 90
Radek Avatar answered Oct 03 '22 06:10

Radek


I needed the same thing, and after reading the project's bug-tracker, I found this:

https://github.com/vakata/jstree/issues/1125

Add the icons to the data you are passing to jstree (you could use "icon" : "jstree-file" for each node you need to have a different icon).

Why this isn't the default, beats me... but, I think this should do what you wanted.

like image 35
wvxvw Avatar answered Oct 03 '22 06:10

wvxvw