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

org.dominokit.domino.ui.datatable.plugins.ScrollingPaginationPlugin 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.ScrollingPagination;

/**
 * Scrolling Pagination Plugin.
 *
 * @param 
 */
public class ScrollingPaginationPlugin implements DataTablePlugin {

    private ScrollingPagination pagination;

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

    public ScrollingPagination getPagination() {
        return pagination;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy