Directory

← Back

TableClickForwarder

Forwards mouse click events on any components within a Table cell to the Table itself

Author

Rating

Popularity

<100

This simple extension is created to overcome an issue where adding e.g. layouts in Table cells will prevent normal item selection when clicking these cells.

The extension will add mouseup and mousedown handlers to the component it's attached to, and forward any mouse up/down events to the parent table cell.

Sample code

Table t = new Table();
t.setSizeFull();
t.setSelectable(true);
t.setMultiSelect(true);

t.addContainerProperty("layout", Component.class, null);
t.addContainerProperty("layout-e", Component.class, null);
t.addContainerProperty("name", String.class, null);

HorizontalLayout hl = null;
for (int i = 0; i < 100; i++) {
    Item item = t.addItem(i);

    item.getItemProperty("name").setValue("Item #" + i);

    hl = new HorizontalLayout(new Label(
            "This label is inside a HorizontalLayout."));
    hl.setWidth("100%");
    item.getItemProperty("layout").setValue(hl);

    hl = new HorizontalLayout(
            new Label(
                    "This label is inside a HorizontalLayout with TableClickForwarder."));
    hl.setWidth("100%");
    new TableClickForwarder(hl);
    item.getItemProperty("layout-e").setValue(hl);
}

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Only forwards clicks from widgets which do not extend Focusable on client side. This should prevent unwanted table row selection when clicking e.g. a button, textfield, checkbox etc.

Released
2013-10-17
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 7.0+
Browser
Internet Explorer
Firefox
Safari
Google Chrome
Internet Explorer
Internet Explorer

TableClickForwarder - Vaadin Add-on Directory

Forwards mouse click events on any components within a Table cell to the Table itself TableClickForwarder - Vaadin Add-on Directory
This simple extension is created to overcome an issue where adding e.g. layouts in Table cells will prevent normal item selection when clicking these cells. The extension will add mouseup and mousedown handlers to the component it's attached to, and forward any mouse up/down events to the parent table cell.
Online