Hi,
I am creating a Table and am using a default container (i.e. Indexed Container) for it. I have two different sets of Objects which have I want to categorize in the table as the table gets populated/rendered. The property of the object is what decides If the object belongs to the first category or the second category and the table does not have that column as visible. So, how can I sort rows belonging to two categories when I have a table, and Indexed container and a property which does not have any visible column related to it but which defines which object belongs to what category. Also, How can I have introduce some style (like a dark black line) so that I can view the two categorise seperately.
final Table table = new Table(caption);
final List<Object> visibleColumns = new ArrayList<Object>();
table.addContainerProperty("id", Integer.class, null);
table.addContainerProperty("User/Group", Label.class, null);
visibleColumns.add("User/Group");
for (final String permission : perms) {
table.addContainerProperty(permission, NativeSelect.class, null);
visibleColumns.add(permission);
}
table.setVisibleColumns(visibleColumns.toArray());
table.setSortEnabled(false);
Integer tableId = new Integer(0);
final IndexedContainer container = (IndexedContainer) securityTable.getContainerDataSource();
if (container instanceof IndexedContainer) {
final Collection<?> propIds = container.getSortableContainerPropertyIds();
final List<NativeSelect> nativeSelects = createNativeSelects();
final Object[] labelArray = {
userName
};
final Object[] nsArray = nativeSelects.toArray(new Object[nativeSelects.size()]
);
final Object[] row = new Object[nativeSelects.size() + 1]
;
System.arraycopy(labelArray, 0, row, 0, labelArray.length);
System.arraycopy(nsArray, 0, row, labelArray.length, nsArray.length);
final Object id = securityTable.addItem(row, tableId);
final Item item = container.getItem(id);
item.getItemProperty("id").setValue((userSid.isPrinciple() == true) ? tableId : tableId * 100);
tableId++;
}