Hi Folks ,
I have telerik:RadGridView Data binded to QueryableCollectionView and I clear the descriptors using the following line
it works fine but still the searched text appeared in FilterRow cell . How can I clear the filtered row too ?
I have telerik:RadGridView Data binded to QueryableCollectionView and I clear the descriptors using the following line
MainGridVM.Data.FilterDescriptors.Clear();
it works fine but still the searched text appeared in FilterRow cell . How can I clear the filtered row too ?
6 Answers, 1 is accepted
0
Hi,
I would suggest you to check the Programmatic Filtering help article where you can find more information about how to clear RadGridView's filters.
Regards,
Yoan
Telerik
I would suggest you to check the Programmatic Filtering help article where you can find more information about how to clear RadGridView's filters.
Regards,
Yoan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Mohammed
Top achievements
Rank 1
answered on 26 Feb 2015, 02:26 PM
Thanks Yoan ,
It works fine but it changed my default filter operator (Contains) and reset it to (Equal) do you know how to set it back to contains .?
Regards,
Mohammed Thabet
It works fine but it changed my default filter operator (Contains) and reset it to (Equal) do you know how to set it back to contains .?
Regards,
Mohammed Thabet
0
Hello,
You can check the Change the Default Selected Filter Operators help article for a reference.
Regards,
Yoan
Telerik
You can check the Change the Default Selected Filter Operators help article for a reference.
Regards,
Yoan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Mohammed
Top achievements
Rank 1
answered on 04 Mar 2015, 09:19 AM
Thanks Yoan ,
We already used this event (OnRadGridViewFilterOperatorsLoading ) but we can not fire this event after reset filters so in columns loop we set default operator to (contains ) but my problem in case of DateTime columns (Contains) are not right so default operator for datetime columns should be (IsEqualTo) .How to apply it in reset method ?
void grdRequests_OnResetFilters(object sender, EventArgs e)
{
grdRequests.FilterDescriptors.SuspendNotifications();
foreach(var column in grdRequests.Columns)
{
column.SortingState = SortingState.None;
column.ClearFilters();
column.ColumnFilterDescriptor.FieldFilter.Filter1.Operator = FilterOperator.Contains;
}
grdRequests.FilterDescriptors.ResumeNotifications();
}
//////////////////////////////////////////
private void grdRequests_FilterOperatorsLoading(object sender, FilterOperatorsLoadingEventArgs e)
{
if (e.AvailableOperators.Contains(FilterOperator.Contains))
{
e.DefaultOperator1 = FilterOperator.Contains;
}
else if (e.AvailableOperators.Contains(FilterOperator.IsEqualTo))
{
e.DefaultOperator1 = FilterOperator.IsEqualTo;
}
}
We already used this event (OnRadGridViewFilterOperatorsLoading ) but we can not fire this event after reset filters so in columns loop we set default operator to (contains ) but my problem in case of DateTime columns (Contains) are not right so default operator for datetime columns should be (IsEqualTo) .How to apply it in reset method ?
void grdRequests_OnResetFilters(object sender, EventArgs e)
{
grdRequests.FilterDescriptors.SuspendNotifications();
foreach(var column in grdRequests.Columns)
{
column.SortingState = SortingState.None;
column.ClearFilters();
column.ColumnFilterDescriptor.FieldFilter.Filter1.Operator = FilterOperator.Contains;
}
grdRequests.FilterDescriptors.ResumeNotifications();
}
//////////////////////////////////////////
private void grdRequests_FilterOperatorsLoading(object sender, FilterOperatorsLoadingEventArgs e)
{
if (e.AvailableOperators.Contains(FilterOperator.Contains))
{
e.DefaultOperator1 = FilterOperator.Contains;
}
else if (e.AvailableOperators.Contains(FilterOperator.IsEqualTo))
{
e.DefaultOperator1 = FilterOperator.IsEqualTo;
}
}
0
Mohammed
Top achievements
Rank 1
answered on 04 Mar 2015, 12:53 PM
I just need to be clear that we did it on grdRequests_OnResetFilters() using AvailableOperators but I can not use it from gridcolumn . Just need to be clear in my question ,
Regards ,
Mohammed Thabet
Regards ,
Mohammed Thabet
0
Hi,
You will need to apply a similar logic when clearing the current filter.
For example:
Regards,
Dimitrina
Telerik
You will need to apply a similar logic when clearing the current filter.
For example:
grdRequests.FilterDescriptors.SuspendNotifications();
foreach
(GridViewDataColumn column
in
grdRequests.Columns.OfType<GridViewDataColumn>())
{
column.SortingState = SortingState.None;
column.ClearFilters();
var datatype = column.DataType;
if
(datatype ==
typeof
(DateTime) || datatype ==
typeof
(Int32))
{
column.ColumnFilterDescriptor.FieldFilter.Filter1.Operator = FilterOperator.IsEqualTo;
}
else
{
column.ColumnFilterDescriptor.FieldFilter.Filter1.Operator = FilterOperator.Contains;
}
}
grdRequests.FilterDescriptors.ResumeNotifications();
Regards,
Dimitrina
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.