EasyUI Forum
April 29, 2024, 10:38:41 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: TreeGrid: empty folder icon  (Read 6883 times)
Sapphire
Newbie
*
Posts: 8


View Profile
« on: May 08, 2014, 11:22:55 PM »

Hello together,

based on the Lazy loading nodes in TreeGrid example (http://www.jeasyui.com/tutorial/tree/treegrid5.php) i have question about node with an empty children list.

I have modified the data set for this example and add a node with an empty children list on the end

{
   "id":99,
   "name":"D",
   "size":"",
   "date":"02/19/2010",
   "children":[
   ]   
}

In the a attached picture (empty_folder1.jpg) you can see a folder icon for D.

If i remove the lazy load functionality by removing the loadFilter data-option from the html file i got this result (empty_folder2.jpg)

The you can see a file icon for D.

How i can defined which icon is display for a node with a children list without members (empty folder).
« Last Edit: May 08, 2014, 11:36:42 PM by Sapphire » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: May 09, 2014, 12:40:04 AM »

Override the 'setData' function as below and they will have the same behavior.
Code:
function setData(data){
var todo = [];
for(var i=0; i<data.length; i++){
todo.push(data[i]);
}
while(todo.length){
var node = todo.shift();
if (node.children && node.children.length){
node.state = 'closed';
node.children1 = node.children;
node.children = undefined;
todo = todo.concat(node.children1);
}
}
}
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!