Custom Clear Button action in Filter Menu popup
I created a filter template for an SfGrid that I'm using to add the ability to filter by a date range (using DateRangePicker). My question is whether the default "Clear Button" on the filter popup can be overridden with some custom code to clear items that I'm using for the Date Range filter.
Alternately, another route I could take is adding a custom button into that popup and hiding the default Clear button along with the apply button (no problem here, already hiding apply and the operator drop down).
Thanks for any help you can provide.
SIGN IN To post a reply.
3 Replies
RS
Renjith Singh Rajendran
Syncfusion Team
September 3, 2021 05:06 AM UTC
Hi William,
Greetings from Syncfusion support.
Based on this scenario, we suggest you to hide the footer area of filter menu dialog for the particular column using styles based on the ColumnName and RequestType as FilterBeforeOpen inside OnActionBegin. And then render a custom button inside FilterTemplate along with SfDateRangePicker.
Please refer and use as like the codes below,
|
<GridEvents OnActionBegin="OnActionBegin" TValue="Order"></GridEvents>
...
<FilterTemplate>
<SfDateRangePicker @ref="RangePickerRef" TValue="DateTime?"></SfDateRangePicker><br /><br />
<SfButton OnClick="OnClick">Clear</SfButton>
</FilterTemplate>
</GridColumn>
@if (@IsCustomComponent) @*Based on IsCustomComponent value apply styles*@
{
<style>
.e-filter-popup .e-footer-content {
display: none;
}
</style>
}
public bool IsCustomComponent = false;
SfDateRangePicker<DateTime?> RangePickerRef;
public void OnClick()
{
//hear handle custom clear action
}
public void OnActionBegin(ActionEventArgs<Order> Args)
{
if (Args.RequestType.Equals(Action.FilterBeforeOpen))
{
if (Args.ColumnName == "OrderDate") //Based on the column having custom component set the IsCustomComponent value
{
IsCustomComponent = true;
}
else
{
IsCustomComponent = false;
}
}
}
... |
References :
Please get back to us if you need further assistance.
Regards,
Renjith R
AT
Andy Terbovich
September 3, 2021 10:28 AM UTC
Thanks! This works great.
RS
Renjith Singh Rajendran
Syncfusion Team
September 6, 2021 04:32 AM UTC
Hi William,
Thanks for your update. Please get back to us if you need further assistance.
Regards,
Renjith R
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
AT Andy Terbovich
- Sep 2, 2021 03:38 PM UTC
- Sep 6, 2021 04:32 AM UTC