Documentation

(vaadin)

Vaadin UI code snippets

This is an old revision of the document!


We have a list of useful code snippets for you. Simply use them for your application. All snippets are free to use and licensed under Apache 2.0.

Checkbox in Table Header

If you want to show a checkbox in the table header of a v7 Table:

use following code:

book.getRowDefinition().getColumnDefinition("CHECK").setSortable(false)
book.getRowDefinition().getColumnDefinition("CHECK")
    .setLabel("<input type='checkbox' id='checkboxSelectAll' onclick=\"selectAllListener(this.checked)\" " +
              "style=\"position:absolute;top: 2px;\"/>");

and to receive events from the checkbox:

JavaScript.getCurrent().addFunction("selectAllListener", new JavaScriptFunction() 
{
    public void call(JsonArray arguments) 
    {
        System.out.println("Pressed!");
    }
});
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information