Cancel filter?

6 posts, 0 answers
  1. Mike
    Mike avatar
    79 posts
    Member since:
    Nov 2011

    Posted 27 Sep 2012 Link to this post

    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.
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 28 Sep 2012 Link to this post

    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.

  3. Mike
    Mike avatar
    79 posts
    Member since:
    Nov 2011

    Posted 28 Sep 2012 Link to this post

    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.
  4. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 28 Sep 2012 Link to this post

    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.

  5. Mike
    Mike avatar
    79 posts
    Member since:
    Nov 2011

    Posted 28 Sep 2012 Link to this post

    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.
  6. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 28 Sep 2012 Link to this post

    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.

Back to Top