Class SpreadsheetFilterTable
- All Implemented Interfaces:
Serializable
SpreadsheetFilter) inside the table's headers' pop-up buttons.
Does simple filtering by hiding the filtered rows from the table (as in Excel).
Automatically generates "item filters" (ItemFilter) for each column.
Has a "Clear Filters" button inside the PopupButtons pop-up, that
clears all the filters for that column (contained within the same pop-up).
- Since:
- 23.1
- Author:
- Vaadin Ltd.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated, for removal: This API element is subject to removal in a future version.The "Clear filters" button will be removed in Vaadin 26.static final Stringprotected org.apache.poi.ss.util.CellRangeAddressprotected final Map<PopupButton, com.vaadin.flow.component.button.Button> Deprecated, for removal: This API element is subject to removal in a future version.The "Clear filters" button will be removed in Vaadin 26.protected final Map<PopupButton, HashSet<SpreadsheetFilter>> Fields inherited from class com.vaadin.flow.component.spreadsheet.SpreadsheetTable
popupButtons -
Constructor Summary
ConstructorsConstructorDescriptionSpreadsheetFilterTable(Spreadsheet spreadsheet, org.apache.poi.ss.usermodel.Sheet sheet, org.apache.poi.ss.util.CellRangeAddress fullTableRegion) Creates a new filter table for the given spreadsheet component, sheet and region.SpreadsheetFilterTable(Spreadsheet spreadsheet, org.apache.poi.ss.usermodel.Sheet sheet, org.apache.poi.ss.util.CellRangeAddress fullTableRegion, org.openxmlformats.schemas.spreadsheetml.x2006.main.CTAutoFilter ctWorksheetAutoFilter, org.apache.poi.xssf.usermodel.XSSFTable xssfTable) SpreadsheetFilterTable(Spreadsheet spreadsheet, org.apache.poi.ss.util.CellRangeAddress fullTableRegion) Creates a new filter table for the given spreadsheet component, its active sheet (Spreadsheet.getActiveSheet()and region. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all the pop-up buttons and their contents (filters).voidClears all filters for this table.protected com.vaadin.flow.component.button.ButtonDeprecated, for removal: This API element is subject to removal in a future version.The "Clear filters" button will be removed in Vaadin 26.org.apache.poi.ss.util.CellRangeAddressGets the filtering region,CellRangeAddressfor this table.protected voidDeprecated, for removal: This API element is subject to removal in a future version.The "Clear filters" button will be removed in Vaadin 26.protected voidCreates all filters for this table.protected voidCreates item filters for this table.voidCalled when one of the filters (SpreadsheetFilter) has been updated, and the sheet (SpreadsheetTable.getSheet()) and component (SpreadsheetTable.getSpreadsheet()) need to be updated to reflect to the filters' values.voidregisterFilter(PopupButton popupButton, SpreadsheetFilter filter) Registers a new filter to this filter table and adds it inside the given pop-up button.voidreload()Reloads all the pop-up buttons and the pop-up contents (filters).voidunRegisterFilter(PopupButton popupButton, SpreadsheetFilter filter) Unregisters the filter from this filter table and removes it from the given pop-up button.Methods inherited from class com.vaadin.flow.component.spreadsheet.SpreadsheetTable
getCtWorksheetAutoFilter, getFullTableRegion, getPopupButton, getPopupButton, getPopupButtons, getSheet, getSpreadsheet, getXssfTable, initPopupButtons, isTableSheetCurrentlyActive, setCtWorksheetAutoFilter, setXssfTable
-
Field Details
-
CLEAR_FILTERS_BUTTON_CLASSNAME
@Deprecated(since="25.3", forRemoval=true) public static final String CLEAR_FILTERS_BUTTON_CLASSNAMEDeprecated, for removal: This API element is subject to removal in a future version.The "Clear filters" button will be removed in Vaadin 26. UseclearAllFilters()and bind it to a button of your own instead.- See Also:
-
FILTER_TABLE_CONTENT_CLASSNAME
- See Also:
-
popupButtonToFiltersMap
-
popupButtonToClearButtonMap
@Deprecated(since="25.3", forRemoval=true) protected final Map<PopupButton,com.vaadin.flow.component.button.Button> popupButtonToClearButtonMapDeprecated, for removal: This API element is subject to removal in a future version.The "Clear filters" button will be removed in Vaadin 26. UseclearAllFilters()and bind it to a button of your own instead. -
filteringRegion
protected org.apache.poi.ss.util.CellRangeAddress filteringRegion
-
-
Constructor Details
-
SpreadsheetFilterTable
public SpreadsheetFilterTable(Spreadsheet spreadsheet, org.apache.poi.ss.util.CellRangeAddress fullTableRegion) Creates a new filter table for the given spreadsheet component, its active sheet (Spreadsheet.getActiveSheet()and region. Pop-up buttons and content (filters) are created.- Parameters:
spreadsheet- Target SpreadsheetfullTableRegion- Cell range to include in the table
-
SpreadsheetFilterTable
public SpreadsheetFilterTable(Spreadsheet spreadsheet, org.apache.poi.ss.usermodel.Sheet sheet, org.apache.poi.ss.util.CellRangeAddress fullTableRegion) Creates a new filter table for the given spreadsheet component, sheet and region. If the component is currently displaying the sheet that the table belongs to, pop-up buttons and content (filters) are created.- Parameters:
spreadsheet- Target Spreadsheetsheet- Target sheet within the SpreadsheetfullTableRegion- Cell range to include in the table
-
SpreadsheetFilterTable
public SpreadsheetFilterTable(Spreadsheet spreadsheet, org.apache.poi.ss.usermodel.Sheet sheet, org.apache.poi.ss.util.CellRangeAddress fullTableRegion, org.openxmlformats.schemas.spreadsheetml.x2006.main.CTAutoFilter ctWorksheetAutoFilter, org.apache.poi.xssf.usermodel.XSSFTable xssfTable)
-
-
Method Details
-
reload
public void reload()Reloads all the pop-up buttons and the pop-up contents (filters).If the pop-up buttons and filters have been cleared (
clear()has been called) they will be recreated with "empty" filters. Otherwise the existing pop-up buttons are just added to the component again.- Overrides:
reloadin classSpreadsheetTable
-
clear
public void clear()Clears all the pop-up buttons and their contents (filters).If this Table is reloaded after this method has been called, the filters will have cleared their states.
- Overrides:
clearin classSpreadsheetTable
-
clearAllFilters
public void clearAllFilters()Clears all filters for this table. Does not remove the actual filter components. -
initClearAllButtons
Deprecated, for removal: This API element is subject to removal in a future version.The "Clear filters" button will be removed in Vaadin 26. UseclearAllFilters()and bind it to a button of your own instead.Creates the "Clear filters" buttons for the pop-ups. -
initFilters
protected void initFilters()Creates all filters for this table. Override this in an extending class for adding filters on class construction. -
initItemFilters
protected void initItemFilters()Creates item filters for this table. -
createClearButton
@Deprecated(since="25.3", forRemoval=true) protected com.vaadin.flow.component.button.Button createClearButton()Deprecated, for removal: This API element is subject to removal in a future version.The "Clear filters" button will be removed in Vaadin 26. UseclearAllFilters()and bind it to a button of your own instead.Creates a "Clear filters" button. It has the "clear-filters-button" class name.- Returns:
- Button for clearing the filters
-
getFilteringRegion
public org.apache.poi.ss.util.CellRangeAddress getFilteringRegion()Gets the filtering region,CellRangeAddressfor this table.- Returns:
- The filtering region
-
onFiltersUpdated
public void onFiltersUpdated()Called when one of the filters (SpreadsheetFilter) has been updated, and the sheet (SpreadsheetTable.getSheet()) and component (SpreadsheetTable.getSpreadsheet()) need to be updated to reflect to the filters' values.NOTE: The default ItemFilters will call this method automatically on change. You only need to call this method when you have implemented and added your own SpreadsheetFilter.
-
registerFilter
Registers a new filter to this filter table and adds it inside the given pop-up button.NOTE: Does not apply updates, if the registered filter is filtering some rows,
onFiltersUpdated()should be called.- Parameters:
popupButton- The pop-up button this filter is added tofilter- The filter to apply
-
unRegisterFilter
Unregisters the filter from this filter table and removes it from the given pop-up button.- Parameters:
popupButton- The pop-up button this filter is removed fromfilter- The filter to remove
-