Matthias Hamann
Matthias Hamann

Reputation: 727

Custom double click event on table

I have a customer table. I don't want to get the edit screen by double clicking on the item.

How could I change the default double-click action on the table?

Upvotes: 2

Views: 1058

Answers (3)

olivmir
olivmir

Reputation: 722

Solution for Vaadin 8 table:

grid.addItemClickListener(new ItemClickListener<MyType>() {
    @Override
    public void itemClick(Grid.ItemClick<MyType> event) {
    if (event.getMouseEventDetails().isDoubleClick()) {
        ...

        

Upvotes: 0

aleksey.stukalov
aleksey.stukalov

Reputation: 882

According to the documentation you can define action for the double-click event, by using the Table#setItemClickAction method.

Upvotes: 1

Paolo Forgia
Paolo Forgia

Reputation: 6748

It's really easy, just use event.isDoubleClick() like this:

table.addListener(new ItemClickEvent.ItemClickListener() {

    public void itemClick(ItemClickEvent event) {
        if (event.isDoubleClick()) {
            // The item was double-clicked, event.getItem() returns the target.
        }
    }
});

Source: https://vaadin.com/forum/#!/thread/119309/119308

Upvotes: 2

Related Questions