Textfield in Table

Hi,

is there a way to add a text into a table with some other items as in the attachement?!

I want to show a warning if there are no items in the table checked!

Thx
12889.png

Could you please elaborate a little. You want to have rows with only texts, mixed with other rows, or did I misunderstand?

correct, i want to add a row with a different structure as the others

Hm, I don’t think that’s possible to do it that way, since an Item has several properties that correspond to the columns. Well, as a workaround, you could add a layout as a container Property, something like this:

table.addContainerProperty("Layout", AbstractOrderedLayout.class, null);

and then, when adding the Item:

VerticalLayout vl = new VerticalLayout();
table.addItem(vl).getItemProperty("Layout").setValue(vl);

However, that column would be reserved for the layouts, so you might have to change the structure of your code. Also problems with css and aligning the items may become a problem. Why not just add everything to a scrollable Panel, or do you need sorting?

good idea but sorting is required. i´ve read somethin about a columngenerator or something like that. is that a way to solve the problem? Or isn´t it to change the structure of the column?

If you want to add custom sorting for the Table, you could for instance extend the DefaultItemSorter, like this (if you don’t use any custom containers for the table)

((IndexedContainer) table.getContainerDataSource()).setItemSorter(
new DefaultItemSorter(new Comparator<Object>() { 
    @Override
    public int compare(Object o1, Object o2) { ... } 
});

i don´t need any custom sorting. alphabetical sorting is enough!

Sorry, I meant to say “If you want sorting for your table”, because the only way of sorting it properly if you have stuffed it with layouts, is to override the sorting mechanism yourself. The container could not know which layout should be before the other. :slight_smile:

i´m searching for something like the attached file…

i need to add a text in the table when there ist noch checkbox checked. can you help me?!
12981.png