[bp:GridViewTemplateColumn] How to filter

I have previously asked a related question about filtering on a GridViewTemplateColumn which has not been answered.

Due to a limitation on the GridView inline editing, I have to use a GridViewTemplateColumn instead of a GridViewCheckBoxColumn.

I have the following GridViewTemplateColumn:

<bp:GridViewTemplateColumn ColumnName="Active" AllowSorting="true" AllowFiltering HeaderCssClass="text-center" CssClass="text-center">
    <bp:CheckBox Checked="{value: _this.IsActive}" Enabled="{value: _parent2.IsEditing}"></bp:CheckBox>
</bp:GridViewTemplateColumn>

I need to provide filtering on the Active column. I would like it to look similar to the filtering on a GridViewCheckBoxColumn, like this:
image

I have AllowFiltering on the templated column. However, this is what is rendered when filtering is enabled:
image

What is the best way to add filtering to a templated column?

I am using FilterPlacement="Popup".

Thanks

I should add that I will need to be able to do similar filtering on other GridViewTemplateColumns that are not checkbox columns as well.

Hi! Sorry, I was away for the last month. As far as I can tell, you can use the FilterTemplate property to show any UI you wish. The default component for string columns is the <bp:StringFilterEditor, so you can probably use that.

If you have this on many places and would like to de-duplicate the code, I’d suggest creating a custom GridViewColumn. You can probably actually inherit the GridViewTextColumn, but override the BuildCell method to instantiate a template instead of the TextBox

Thank you for the response. I hope you enjoyed your time away.

Can you provide an example of how to use the bp:StringFilterEditor? (Except in my example, I think it would probably be the bp:BooleanFilterEditor since I am working with a boolean value.)

I tried a few different ways and all of them end with the following message:

DotVVM.Framework.Controls.DotvvmControlException: The Filter property or the FilterGroup property must be set!

Sorry, I also didn’t get this to work and I don’t know what would be the best way to filter a templated column.

You can maybe try to work around this by writing a custom implementation of GridViewColumns, probably just a slightly modified GridViewTextColumns or GridViewCheckBoxColumn