Custom Table

Hello!

Can anyone help me?

I want to create a custom table with a button on top… just below the caption…

Something like this…

Table Caption
[My Button]

ID column|, Name Column| other columns
data | __ data__ ___ |

If it is possible extending Table class…

Any ideas?

Thanks

Nicolás

Hi Nicolas.

I assume that the simplest way to do so, is to use Label instead of Table’s caption. It’ll be look like this:

Label with Table’s Caption
[Your Button]

ID column|, Name Column| other columns
data | __ data__ ___ |

If you would like to create your own component to reuse it, you can extend VerticalLayout, for example, and place components to a proper place in constructor.

It’s just my proposal.

Alex.

You could totally do that but this would require a lot of digging inside the VScrollTable Class and extending/overriding a lot of (sub-)classes/methods (You also have to override the Server-side if you want the button to actually do anything on the server)…Also if you want to do this you should be aware that in Vaadin 7.2 the table component gets rewritten to allow for more customization. The old one will still be around so your work won’t be for nothing but it will probably be easier to do it in 7.2. Just so that you’re aware.
You can also realizes this by creating a server-side CustomComponent which basically is a VerticalLayout with a Label, a Button and a Table. Then you can create methods like setCaption which basically just set the Text of the label.