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

org.dominokit.domino.ui.datatable.plugins.AdvancedPaginationPlugin 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.events.TablePageChangeEvent;
import org.dominokit.domino.ui.pagination.AdvancedPagination;

/**
 * Advanced Pagination Plugin.
 *
 * @param 
 */
public class AdvancedPaginationPlugin implements DataTablePlugin {

    private AdvancedPagination pagination;
    
    public AdvancedPaginationPlugin() {
        this(10);
    }

    public AdvancedPaginationPlugin(int pageSize) {
        this.pagination = AdvancedPagination.create(0, pageSize);
    }
    
    @Override
    public void onAfterAddTable(DataTable dataTable) {
        dataTable.element().appendChild(pagination.element());
        pagination.onPageChanged(pageNumber -> dataTable.fireTableEvent(new TablePageChangeEvent(pageNumber, pagination)));
    }

    public AdvancedPagination getPagination() {
        return pagination;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy