Boolean Switch Filter Value with Or Operator


I am attempting to filter a boolean column in a datagrid called 'Inactive' with a switch component. The desired outcome is when the switch is set to false only false values will be displayed in the datagrid but when it is set to true both true and false values will be displayed.

I created a property on page load called ShowInactive and set it to false.

I then created a switch component called InactiveSwitch and set its value to ${ShowInactive}.

I then set the FilterValue of the Inactive column to ${ShowInactive || false}, the FilterProperty to Inactive and the LogicalFilterOperator to Or.

The page loads as expected, displaying only false values and when I click the filter icon it displays the intended filtering.

But when I activate the switch, the filtering displayed when selecting the filter icon is updated but the changes do not take effect until I deactivate the switch.



As shown, the filter dropdown displays the correct and intended filtering, but the datagrid is only displaying true or false but never both as the filtering dropdown suggests.

So my two questions are:

  1. Is there something I can do to make the datagrid reflect the filtering set by the switch immediately without having to execute the switch again?
  2. How do I make the datagrid filter as intended and the way it is shown when I select the filter icon?



Not sure what’s the purpose of this expression however in my opinion this can be replaced by simply:


Switch component can update value only to true/false and true || false is always true and false || false is always false.

Thank you for your help @enchev.

I tried the expression ${ShowInactive || false} because I had already tried simply using ${ShowInactive} but there is no difference between the results so all previous supplied screenshots and issues still apply other than that change.

Maybe instead binding the Switch value to ${ShowInactive} you can use nullable bool and execute the following code on Switch Change: ShowInactive = args ? null : false.