Hello,
How can I do to specify node's icon from Json data in a Tree Component
part of json data :
{ identifier: 'name',
label: 'name',
items: [
{ name:'Africa', type:'continent', icon:'continent.png'
children:[{_reference:'Egypt'}, {_reference:'Kenya'}, {_reference:'Sudan'}] },
{ name:'Egypt', type:'country' },
{ name:'Kenya', type:'country',
children:[{_reference:'Nairobi'}, {_reference:'Mombasa'}] },
docs, hacks, solutions, ..
thanks for your help.

Do it in CSS
Create a style in your css that sets the background image for each type of tree node:
{
background: url(path_to_your_image_location/continent.png ) no-repeat;
}
remember to change [path_to_your_image_location] with the relevant path on your system.
Create your own custom getIconClass function to override the tree's default:
//custom getIconClass function for the role tree var iconFunc = function( /*StoreItem*/ item, /*boolean*/ opened ){ return item.icon[0]; //this is hacky - should really use the tree store's to get the item's 'icon' value };iconFunc is just an example name.
Then, when creating the tree that will show the data, in the constructor params set:
Then change your json data so that the 'icon' property of the continent item is 'icon: "continent"'
Thats it - but you should probably take note of the hacky comment in this implementation and use the tree store to get the icon property of the selected store item.
Thanks for your Help, Works
Thanks for your Help,
Works like a charm ;)