gaiver
April 8, 2010, 8:39am
#1
Hello, I have problem with render empty folders from json files.
For example I have 3 folders, which I will need display. Two of them with files and one of them empty.
This is json source file:
{id:0,item:[
{id:1, text:“FirstFolder”, item:[
{id:2, text:“FirstFile.ini”},
{id:3, text:“SecondFile.ini”}]},
{id:4, text:“SecondFolder”, item:[
{id:5, text:“FirstFile.ini”},
{id:6, text:“SecondFile.ini”}]},
{id:7, text:“ThirdFolder”, item:[]}
]
}
After generating tree, I see:
But “ThirdFolder” also folder, but looks like file. Maybe my json structure incorrect? Or something else?
Thank’s for your respond
In the tree, elements are rendered as folders only if they have non-zero count of child items. Which is not in your case.
You can define images, which will be used by the item directly in json, so it will always show a folder icon, without relation to count of child items
gaiver
April 9, 2010, 12:26pm
#3
Thank you for your reply.
But I can’t find JSON specification, which will allow me make correct json file. Please, can you write some example with directly definition of icon or tell me where I can read about that?
Thank you!
gaiver
April 12, 2010, 10:46am
#4
You mean something like this:
{id:2, img:“icon.png” ,text:“FirstFile.ini”} ?
The example:
{id:2, im0:“icon.png”,im1:“icon.png”,im2:“icon.png”,text:“FirstFile.ini”}
im0 - the icon for a leaf node;
im1 - the icon for an expanded parent node;
im2 - the icon for a collapsed parent node.