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.
<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;
}
}
}
... |
Thanks! This works great.