Open jcgueriaud1 opened 4 years ago
Related vaadin-grid
issue https://github.com/vaadin/vaadin-grid/issues/1431
Closing as duplicate of vaadin/vaadin-grid-flow#341 (which depends on the web component issue linked above).
Is it really a duplicate? A column visibility toggler for the grid is quite different than a hidable attribute for column.
Dupe of this then? https://github.com/vaadin/vaadin-grid/issues/1431
Same idea: hidable attribute for the vaadin-grid. Not really a column visibility toggler. I won't have any labels for the toggler, not the component. Probably dupe of this: https://github.com/vaadin/vaadin-grid/issues/819 but it's just an example not something in the component.
The description of the issue doesn't clearly state it but it seems to also be about the UI controls for toggling visiblity: https://github.com/vaadin/vaadin-grid/issues/1431#issuecomment-423908532
I believe this bug references the Column Visibility Picker Popup that used to be provided by Vaadin 8 Grid but is no longer provided by Vaadin 14 Grid. Since the feature is still missing, I'd suggest to reopen this issue.
There is one example to implement it as a custom component here: https://github.com/TatuLund/devday-demo-flow/blob/master/src/main/java/com/vaadin/devday/demo/views/GridView.java#L142
There is another example of how to implement this in the cookbook: https://cookbook.vaadin.com/grid-column-toggle
The documentation for column visibility, which includes an example of this: https://vaadin.com/docs/latest/ds/components/grid/#column-visibility
The initial implementation of this could be just the column toggle dropdown itself, with an API for triggering it from anywhere. That way each application could implement the trigger in whatever makes the most sense there (custom Grid toolbar, right-click context menu, whatever).
We could then later provide an option to show a standard trigger somewhere somehow.
Design detail: the button for opening the column selector should provide some kind of indication when one or more columns are hidden.
I missed this feature (again) today while trying to clean up one of our start.vaadin.com templates: https://github.com/mstahv/enhancing-master-detail-view/commit/62a5ac73c980fef483805f7280013fca5c226ca4
I modified the workaround shared previously to be triggered via "column selector icon", like in previous Vaadin versions, and it is now shared in in.virit:viritin:2.0.1. See this change how it is down and how to use it.
Just as concept testing and feeling I have had column selector menu in BeanTable for a while
https://v-herd.eu/tatulund-addons/beantable
Just noting that in addition to Vaadin 8 style menu as shown in the demo, the component has actually two modes for the menu, the button on the right corner and context menu that opens by right click. (configurable via API).
Having this as the default feature available in grid is what I'm thinking of. If not provide APIs to have this toggleColumn visibility and also considering the ViewPort size automatically identify how many columns to show. Then user can use this toggle button if they want to see more or less. Also have some click listener for this toggle button checked/unchecked if any custom action is required for the developer
We could consider combining this with an alternative column reordering (maybe also resizing) UI for users who can't do drag-n-drop: https://github.com/vaadin/web-components/issues/130
The column visibility toggler is a common feature for datatable.
Is it possible to add this feature in vaadin-grid or add an example of code to create a column toggler? There are few problems or missing features: (if you have a simple solution for these, please comment this ticket)
Here one forum post: https://vaadin.com/forum/thread/17131429/set-hidable-and-hidden-columns-in-grid