This is a migrated thread and some comments may be shown as answers.

Cancel filter?

5 Answers 20 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 27 Sep 2012, 03:10 PM
Hello, 

I'm looking for the way to cancel, not clear or disable, just cancel filtering operation. 

This is my senario:
1- User click on icon filter, then the filter pop-up is opened.
2- User apply filter by choosing one of distinct values or by typing a value in filter field
3- A confirmation message is shown,
        a- The user can chose to do the filter (Ok) then, noting to do, the Datagrid component do the filtering operation well
b- The user can chose to cancel filter (Cancel), but the problem is that the Radwindow is not modal. So the Datagrid has already filtered data. How can I do to Cancel the previous, and just the previous filtering operation, Or how can I pause filtering operation and resume it.

Thanks for help.

5 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 28 Sep 2012, 07:14 AM
Hi,

The only functionality that RadGridView offers in this direction is the Filtering event. In the event handler, you can set e.Cancel to true.

Greetings,
Ross
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Mike
Top achievements
Rank 1
answered on 28 Sep 2012, 08:03 AM
Hi, 
Thanks for relpy. 
But The RadWindow is not modal (not like Windows.MessageBox). It means that the filtering operation is already done when the user click on Cancel button. 

This is my code 

private void MyGrid_Filtering(object sender, GridViewFilteringEventArgs e)
        {
            RadWindow.Confirm("ConfirmationMessage", (_sender, _e) =>
                                                         {
                                                             if (!_e.DialogResult.Value)
                                                                 e.Cancel = true;
                                                         });
        }

Is there any way to do that please?
Thanks.
0
Rossen Hristov
Telerik team
answered on 28 Sep 2012, 08:16 AM
Hello,

Can you try with the stock Silverlight MessageBox?

Kind regards,
Ross
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Mike
Top achievements
Rank 1
answered on 28 Sep 2012, 09:40 AM
Hi, 

I find the way that fit perfectly to my need :)
The solution is very simple. I save my filters to a local variable if user choose Ok, and I load saved filters if user choose Cancel :)

This my code:
private void MyGrid_Filtering(object sender, GridViewFilteringEventArgs e)
        {
            RadWindow.Confirm("ConfirmationMessage", (_sender, _e) =>
  {
if(_e.DialogResult.Value)
TableUISetting = FilterSerializer.SaveColumnFilters(MyGrid);
    else
      FilterSerializer.LoadColumnFilters(MyGrid, TableUISetting);
                                                         
});
        }

Just one note:
I used this class to save and load my filters, but there is a bug in the LoadColumnFilters function. You should clear all grid filters before start loading the saved settings.

Thanks.
0
Rossen Hristov
Telerik team
answered on 28 Sep 2012, 10:24 AM
Hi,

That is not a bug. It is up to the developer if he wants to clear the existing filters before loading the saved ones. We don't know which customer wants what.

The method LoadColumnFilters does exactly what it names says -- it loads the saved filters. It is not its job to clear the existing ones before that. You have the choice to do so if you find it necessary as you have already figured out.

Greetings,
Ross
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

Tags
GridView
Asked by
Mike
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Mike
Top achievements
Rank 1
Share this question
or