1

I am trying to use CSS classes for icons instead of the icon property

so instead of having

{icon : "public/assets/icon.gif" } ;

to have something like

{icon : className} ;

If this possible ? If not , is it something i can do with jQuery ?

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
VIPC
  • 39
  • 2
  • 7

2 Answers2

1

You can use the icon property, like you are doing right now.

From the documentation:

boolean | string icon Define this node's icon. undefined: Use global tree option of the same name true: Use default icon, depending on node.folder and node.expanded status false: Hide icon String: A string value that contains a '/' or a '.' is used as src attribute for a tag. (See also the global imagePath option.) Any other string value is used to generate custom tags, e.g. for "ui-icon ui-icon-heart": .

Nsevens
  • 2,588
  • 1
  • 17
  • 34
1

Yes, it is possible to change image from CSS, Try this

.icon:before{
   content: url(public/assets/icon.gif);
}


{icon : 'icon'}
Dhurba Baral
  • 559
  • 5
  • 12
  • 1
    I think you mean: .icon:before{ content: url("public/assets/icon.gif"); } {icon : 'icon'} – VIPC Sep 28 '16 at 08:35
  • {icon: icon} seems to break the JSON , it neds {icon: 'icon'} but works , thanks – VIPC Sep 28 '16 at 09:17