Hi,
I need the value from list which is the child element in TreeTable.
Here is my code:--------------------
//Code for addContainerProperty
TreeTable table = new TreeTable(“TreeTable”) ;
final HierarchicalContainer container = new HierarchicalContainer();
table.setContainerDataSource(container);
table.setImmediate(true);
container.addContainerProperty(“billOfladingNo”, String.class, “”);
//Code to display the TreeTable in the View
table.setPageLength(15);
table.setVisibleColumns(
new Object {"containerNo"});
table.setColumnHeaders(
new String {"Container No."});
[b]
(Here we are using the addGeneratedColumn to apply the Color based on Container number we are getting
for Table component, the code is working good but for TreeTable it is not working)
[/b]
table.addGeneratedColumn(“containerNo”, new Table.ColumnGenerator() {
@Override
public Component generateCell(final Table source, final Object itemId, final Object columnId) {
[b]
//Trail 1
[/b]
String containerNo = item.getItemProperty(“containerNo”).getValue().toString(); //This Line Throughs NullPointerException since item is null.
[b]
//Trial2
[/b]
final HierarchicalContainer container = new HierarchicalContainer();
table.setContainerDataSource(container);
Item item1 = (Item) container.getParent(itemId);
container.getContainerProperty(itemId,“containerNo”);//It returns an interger value
[b]
//Trial3
[/b]
Container dataSource = source.getContainerDataSource();
if (dataSource instanceof Container.Hierarchical) {
Container.Hierarchical h1 = (Container.Hierarchical) dataSource;
System.out.println(“child::::::” + h1.getChildren(1)); //This continously displays the first record value , but does not display the remaining records
return new Label();
}
});
Above are my 3 Trials but none of them works.
I need the value from list which is the child element in TreeTable.
Example:-
1A
Child1
2B
Child2
3C
Child3
So i need Child1 ,Child2 and Child3 to apply some logic but it always displays Child1.
(Can we get the same behaviour of addGeneratedColumn of Table into TreeTable)
Any Help is appreciated