Class AdvancedGrid<T>

java.lang.Object
com.vaadin.flow.component.Component
org.vaadin.addons.antlerflow.grid.AdvancedGrid<T>
Type Parameters:
T - the type of items contained in the grid
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasComponentsOfType<com.vaadin.flow.component.Component>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, Serializable

@Tag("af-advanced-grid") @JsModule("./antlerflow/advanced-grid/advanced-grid.ts") public class AdvancedGrid<T> extends com.vaadin.flow.component.Component implements com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle
AdvancedGrid is a component that enhances the functionality of a standard Grid by incorporating built-in pagination, data export capabilities, a column selector that remembers the user's choice (in the browser, a database or any custom storage), and a customizable toolbar. It is designed to work with various data providers and supports dynamic setting of data, page sizes, and pagination visibility.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Prefix of the storage keys holding column preferences.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    AdvancedGrid(int pageSize)
     
    AdvancedGrid(com.vaadin.flow.component.grid.Grid<T> grid)
     
    AdvancedGrid(com.vaadin.flow.data.provider.BackEndDataProvider<T,Void> dataProvider)
     
    AdvancedGrid(com.vaadin.flow.data.provider.DataProvider<T,Void> dataProvider)
     
    AdvancedGrid(com.vaadin.flow.data.provider.InMemoryDataProvider<T> inMemoryDataProvider)
     
    AdvancedGrid(com.vaadin.flow.data.provider.ListDataProvider<T> dataProvider)
     
    AdvancedGrid(Class<T> beanType)
     
    AdvancedGrid(Class<T> beanType, boolean autoCreateColumns)
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addToActions(com.vaadin.flow.component.Component... components)
    Adds components to the toolbar's action area.
    void
    addToFilters(com.vaadin.flow.component.Component... components)
    Adds components to the "toolbar" slot.
    void
    addToFooter(com.vaadin.flow.component.Component... components)
    Adds components to the "footer" slot.
    void
    Removes the stored column preference from the storage.
    void
    enableColumnSelection(boolean enabled)
    Shows or removes the column selector button.
    void
    enableExport(boolean exportEnabled)
    Shows or removes the export button.
    Returns the full storage key, or empty while it cannot be derived yet.
    boolean
    Returns true when there is something to export with the current configuration: the grid has rows, and for ExportSize.SELECTED at least one row is selected.
    protected void
    onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
     
    void
    Sets the storage key suffix under which the column preference is stored.
    void
    setColumnPreferencePersisted(boolean persisted)
    Turns storing the column preference on (default) or off.
    void
    Sets where the column preference is stored, e.g.
    void
    setDataProvider(com.vaadin.flow.data.provider.DataProvider<T,?> dataProvider)
     
    void
     
    void
    setInnerGrid(com.vaadin.flow.component.grid.Grid<T> innerGrid)
    Injects the given Grid into the "grid" slot inside the Lit template.
    void
    setItems(List<T> items)
     
    void
    setPageSize(int pageSize)
     
    void
    setPageSizes(Integer... pageSizes)
     
    void
    setPaginationVisibility(boolean visibility)
     

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, bindVisible, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisible, whenAttached

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.HasComponents

    add

    Methods inherited from interface com.vaadin.flow.component.HasComponentsOfType

    add, add, addComponentAsFirst, addComponentAtIndex, bindChildren, getChildren, getComponentAt, getComponentCount, indexOf, remove, remove, removeAll, replace

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    bindEnabled, isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.component.HasSize

    bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
  • Field Details

    • COLUMN_PREFERENCE_KEY_PREFIX

      public static final String COLUMN_PREFERENCE_KEY_PREFIX
      Prefix of the storage keys holding column preferences.
      See Also:
  • Constructor Details

    • AdvancedGrid

      public AdvancedGrid()
    • AdvancedGrid

      public AdvancedGrid(com.vaadin.flow.component.grid.Grid<T> grid)
    • AdvancedGrid

      public AdvancedGrid(com.vaadin.flow.data.provider.DataProvider<T,Void> dataProvider)
    • AdvancedGrid

      public AdvancedGrid(com.vaadin.flow.data.provider.BackEndDataProvider<T,Void> dataProvider)
    • AdvancedGrid

      public AdvancedGrid(com.vaadin.flow.data.provider.InMemoryDataProvider<T> inMemoryDataProvider)
    • AdvancedGrid

      public AdvancedGrid(com.vaadin.flow.data.provider.ListDataProvider<T> dataProvider)
    • AdvancedGrid

      public AdvancedGrid(Collection<T> items)
    • AdvancedGrid

      public AdvancedGrid(int pageSize)
    • AdvancedGrid

      public AdvancedGrid(Class<T> beanType, boolean autoCreateColumns)
    • AdvancedGrid

      public AdvancedGrid(Class<T> beanType)
  • Method Details

    • setInnerGrid

      public void setInnerGrid(com.vaadin.flow.component.grid.Grid<T> innerGrid)
      Injects the given Grid into the "grid" slot inside the Lit template.
    • setItems

      public void setItems(List<T> items)
    • setDataProvider

      public void setDataProvider(com.vaadin.flow.data.provider.DataProvider<T,?> dataProvider)
    • setPageSizes

      public void setPageSizes(Integer... pageSizes)
    • setPageSize

      public void setPageSize(int pageSize)
    • setExportConfig

      public void setExportConfig(GridExportConfig<T> exportConfig)
    • enableExport

      public void enableExport(boolean exportEnabled)
      Shows or removes the export button. The button is enabled only while the grid has data to export (and, for ExportSize.SELECTED, while rows are selected). When rows are selected and
      invalid reference
      GridExportConfig#isSelectedRowsOption()
      is on, clicking it lets the user export either the configured rows or only the selected rows.
    • isExportAvailable

      public boolean isExportAvailable()
      Returns true when there is something to export with the current configuration: the grid has rows, and for ExportSize.SELECTED at least one row is selected.
    • enableColumnSelection

      public void enableColumnSelection(boolean enabled)
      Shows or removes the column selector button. The user's choice of displayed columns is kept in the column preference storage (the browser's localStorage by default) under getColumnPreferenceStorageKey() and restored whenever the grid is attached.
    • setColumnPreferenceKey

      public void setColumnPreferenceKey(String key)
      Sets the storage key suffix under which the column preference is stored. Give each grid its own key when a view holds several grids. When not set, the component id is used, or else the current route path.
    • getColumnPreferenceStorageKey

      public Optional<String> getColumnPreferenceStorageKey()
      Returns the full storage key, or empty while it cannot be derived yet.
    • setColumnPreferenceStorage

      public void setColumnPreferenceStorage(ColumnPreferenceStorage storage)
      Sets where the column preference is stored, e.g. ColumnPreferenceStorage.sessionStorage() or a JdbcColumnPreferenceStorage. The preference is loaded from the new storage right away when the grid is attached.
    • setColumnPreferencePersisted

      public void setColumnPreferencePersisted(boolean persisted)
      Turns storing the column preference on (default) or off. Turning it off does not delete an already stored preference; use clearColumnPreference() for that.
    • clearColumnPreference

      public void clearColumnPreference()
      Removes the stored column preference from the storage.
    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Overrides:
      onAttach in class com.vaadin.flow.component.Component
    • setPaginationVisibility

      public void setPaginationVisibility(boolean visibility)
    • addToFilters

      public void addToFilters(com.vaadin.flow.component.Component... components)
      Adds components to the "toolbar" slot.
    • addToActions

      public void addToActions(com.vaadin.flow.component.Component... components)
      Adds components to the toolbar's action area. Buttons get the tertiary theme variant so actions stay quiet next to the grid; remove it with button.removeThemeVariants(ButtonVariant.LUMO_TERTIARY) when an action must stand out.
    • addToFooter

      public void addToFooter(com.vaadin.flow.component.Component... components)
      Adds components to the "footer" slot.