View Full Version : TreeTable with MemoryProxy for File Explorer
jbotiva
28 Apr 2009, 7:06 AM
Hi!
In the Ext GWT 2.0 Explorer, the TreeTable sample shows a file explorer but all the folders have children. I want to know if it is possible to use a TreeTable with a MemoryProxy and a BaseTreeLoader to make a file explorer but with the possibility to have empty folders (they will be leafs but wit a folder icon instead of a file icon) or if I should use the TreeBuilder approach. Thanks in advance.
Regards
You can use both approaches. It is up to you what you like more.
darrellmeyer
29 Apr 2009, 10:25 AM
You can control whether a item is a node or a leaf independent of the actual data. When working with trees directly you can use treeItem.setLeaf(false). If you are using a BaseTreeLoader you can override hasChildren to specify the node state:
final TreeLoader<FileModel> loader = new BaseTreeLoader<FileModel>(proxy) {
@Override
public boolean hasChildren(FileModel parent) {
// insert you custom logic here
return parent instanceof FolderModel;
}
};
jbotiva
29 Apr 2009, 3:52 PM
Overriding hasChildren worked for the TreeTable icons but now I have a problem with the layout used in the LayoutContainer that contains the TreeTable. When I use FitLayout, the table height is limited to the height of the items in the root of the tree, when an item is expanded, a scrollbar is added. When I use FlowLayout, the table height works well but the width of the column headers doesn't match the width of the actual data columns and when a column is resized the columns keep expanding even if I try to reduce its size.
I also want to know if TreeTable supports drag and drop of TreeTableItems within the same TreeTable.
Thanks in advance
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.