Class ColumnSelector<T>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.html.Div>
org.vaadin.addons.antlerflow.grid.columns.ColumnSelector<T>
- Type Parameters:
T- the type of items in the grid
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasStyle, Serializable
public class ColumnSelector<T>
extends com.vaadin.flow.component.Composite<com.vaadin.flow.component.html.Div>
Lets the user choose which columns of a grid are displayed. At least one column always stays
visible. Every change made by the user is reported to the change listener as the complete column
id to visibility map, ready to be persisted.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionColumnSelector(com.vaadin.flow.component.grid.Grid<T> grid, com.vaadin.flow.function.SerializableConsumer<Map<String, Boolean>> changeListener) -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyPreference(Map<String, Boolean> visibility) Applies a stored preference.Returns the current column id to visibility map, in column order.voidrefresh()Re-reads the grid's columns; call it after columns are added or removed.voidreset()Restores the default visibility and reports it to the change listener.voidSwitches the selector to another grid and forgets the previous grid's defaults.Methods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElement, initContentMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
ColumnSelector
-
-
Method Details
-
setGrid
Switches the selector to another grid and forgets the previous grid's defaults. -
refresh
public void refresh()Re-reads the grid's columns; call it after columns are added or removed. -
applyPreference
-
getVisibility
-
reset
public void reset()Restores the default visibility and reports it to the change listener.
-