I need the ability show/hide the GridView filters based on another control on the same page. There is the AllowFiltering property on the columns, but it does not allow for a value binding.
Providing a value binding causes the following error:
DotVVM.Framework.Compilation.DotvvmCompilationException: The property GridViewColumn.AllowFiltering cannot contain value binding. You can use a resource binding instead - the resource will evaluate the expression server-side.
Using a resource value as suggested does work except I can’t then change the value and have the table redrawn with or without the filters shown based on the other control.
How do I show/hide the GridView column filtering using another control on the same page?
Hello, I don’t know if there is a way to actually disable the filtering, but you can definitely hide the UI using CSS. If you also clear the filters in the GridViewDataSet, it will be essentially turned off.
The filtering is always in a row with CSS class dotvvm-bp-grid-view_filter-row inside the GridView control. You can conditionally CSS classes on the GridView element either writing a binding expression into the class attribute or using the Class-hide-filters={value: _this.FiltersHidden} syntax.
Then you can hide the filter row using a CSS rule:
Thank you. The Class-hide-filters solution works pretty well.
The solution I came up with prior to your response was to have two almost identical GridViews on the page with inverse visibility settings. I like your solution much better.