All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.dominokit.domino.ui.datatable.plugins.RowClickPlugin Maven / Gradle / Ivy

There is a newer version: 1.0.139
Show newest version
package org.dominokit.domino.ui.datatable.plugins;

import org.dominokit.domino.ui.datatable.DataTable;
import org.dominokit.domino.ui.datatable.TableRow;
import org.dominokit.domino.ui.utils.DominoElement;
import org.jboss.elemento.EventType;

public class RowClickPlugin implements DataTablePlugin {
    private ClickHandler handler;

    public RowClickPlugin(ClickHandler handler) {
        this.handler = handler;
    }

    @Override
    public void onRowAdded(DataTable dataTable, TableRow tableRow) {
        DominoElement.of(tableRow.element()).styler(style -> style.setCursor("pointer"));
        tableRow.element().addEventListener(EventType.click.getName(), evt -> handler.onClick(tableRow));
    }

    @FunctionalInterface
    public interface ClickHandler {
        void onClick(TableRow tableRow);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy