-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
I have a grid with a menupop to select the hidden/visible columns. When I hide a column and then I click on the header to execute the sorting method, all the columns become visible. Is there any option to keep this columns hidden?
My code is something like this:
<grid id="GRIDCenso" mold="paging" pagingPosition="bottom" autopaging="true"
span="false" sizedByContent="true" pageSize="10" width="100%"
xmlns:a="client/attribute" a:data-scrollable="false"
model="@load(vm.beans)">
<custom-attributes org.zkoss.zul.grid.autohidePaging="false"/>
<custom-attributes org.zkoss.zul.image.preload="true"/>
<columns menupopup="auto-keep" sizable="true">
<column width="40px" sclass="hiddenSelector"/>
<column id="CLCama" sort="auto(cama)" hflex="min"/>
</columns>
Thank you!
there's no such feature available out of the box. When using MVVM you store the UI state anyway in the view model e.g. keep the column-visibilities in a list of booleans, or a map (whatever you prefer), Or just keep a whole list of columnInfo objects containing getters for column information (label, visbilitiy, sortability ...)
You can then control the visibility using a @load-binding.
https://zkfiddle.org/sample/1n6hjff/2-keep-column-visiblity
The column menu can be customized (see fiddle above) at client side or a custom menu can be defined.
Then when sorting is triggered you can trigger the @load binding via notifyChange or as I do in the example using a conditional @load(..., after='sort') binding
Asked: 2020-04-09 15:42:48 +0800
Seen: 8 times
Last updated: Apr 10 '20