I have a new DataGrid with a custom filter on one fields which consist of a dropdown. Changing the dropdown triggers the data grid to load the filtered data as required but, the filter controls remain visible until I click on another object on the screen.
Is there some way to close the filter window similar to what happens when the "Clear" or "Apply" buttons are used on the non-custom advanced filter window.
No errors no but, I am using the FilterMode of advanced on my grid whereas your screenshot looks like simple? Under the DataGrid-> Columns-> FilterTemplate, I have this template:
The DropDown being bound to page properties. When the grid is displayed, it looks like this:
When I click on the filter icon, it shows up like this:
I can change the selection in the dropdown and the grid refreshes but, the filter panel stays visible after making a selection until I click on some other part of the screen.
Indeed the advanced filtering popup will be closed when you click outside of the popup. You can check also the Clear/Apply buttons code how the popup can be closed:
That looks like just what I am after - I've tried adding a button to my filter template and using the same code within an Execute C# handler but, this fails with column not being known. It appears the 2nd parameter is optional but, the first parameter PopupID is required. I can see in the code you link to that this is:
internal string PopupID
{
get
{
return $"popup{UniqueID}";
}
}
If I try and use this code in the page's .razor file, I get the error:
If it's not a silly question, how do I get the ID for the popup which is displayed by the custom filter template?