Hi!
Can someone please write a short snippet on how to:
Fill a treeviewtable with data (f.e. Name, icon, description, dropdown). Especially focus on how to have different components in the columns of a row. The samples provided hide that kind of details…
How to use a Collapsible (?) container, to use as datasource for a treeViewTable.
When SubNode1 is clicked in a TreeTable, how can I detect all nodes that are “above” Subnode1 as which node being the parent of SubNode1 - out of the EventHandler:
treeTable.addListener(new ItemClickEvent.ItemClickListener() {
public void itemClick(ItemClickEvent e) {
//impl goes here
}
}
Which columns are sortable depends on what Table.getSortablePropertyIds() returns, so you can simply click the table header cells to sort those columns. You can override the method if necessary.
If I remember correctly, by default, columns whose types in the container implement Comparable are sortable. Therefore, if using a custom data type, you can implement custom sorting by implementing Comparable in your data type.
Two more comments after using vaadin treeTable now for a while:
I think its quite “nifty” to set TreeNode-Properties on the table itself for each node, instead of setting properties on the nodes, which are added to the table on the way…
The behaviour of disabling children for an item, adding children for that item, which will we attached to the next node having children allowed is strange. And can quickly lead to unexpected behaviour. Consequently I would runtime expect to throw an exception when adding children to a node that does not allow it. Or just drop that property, and render the child expander just in case children exist - most feasible and intuitive.
If adding works as you say, I would consider that a bug - please
file a ticket .
As for the latter suggestion, I believe it would in practice eliminate much of lazy loading in many applications, as you would have to do a large number of checks to see if certain nodes actually have children - sometimes that check can be very expensive.
Okay, want to - but my forum login does not apply there? What is the login to use then?
I think this is the default behaviour of all other TreeViews if been working with so long. Even, as traversing the tree server side, should not be the big deal…
How did you put icons in the table? Do you have code snippet?
The other two problems that I have on my hand are that I have to show data in Pivots and I am using TreeTable for this.
I am posting two images to elaborate what I am asking.
One is how to put text “Grand Totals” in the last row as I have show in image pivot.png
the code I am using is…
if(hasGrandTotals){
Object [] totalsPos = new Object [pivotDepth]
;
for(int i =0;i<headers.length;i++){
if(totals.containsKey(headers[i]
)){
totalsPos[i]
= totals.get(headers[i]
);
}else{
totalsPos[i]
= “”;
}
}
///////////////// This is here that I am putting value in the last row that is grand totals row
Object addGrandTotals = tr.addItem(totalsPos,“GTOT”);
// tr.setColumnHeader(“GTOT”, “G. Totals”); //System.out.println(" tr.getContainer "+ tr.getContainerProperty(addItems[1]
,“School”).getValue());
tr.setChildrenAllowed(“GTOT”, false);
}
The other problem is that when now I have to show pivot like this in TreeTable or using some other idea like using Labels etc or other API to show Pivot like in the image file pivot2.gif
Is there a way that will enable us to use wrapper around GWT component so that GWT Pivot api can be used to display Pivot tables in Vaadin…