IGridFilterPopup

10 posts, 0 answers
  1. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 14 Dec 2011 Link to this post

    I'm trying to find an example of creating a custom grid filter popup.  Anybody have one yet?
  2. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 19 Dec 2011 Link to this post

    Hi Jason,

    Thank you for writing.

    Can you please specify in greater detail what are you trying to accomplish so we can provide you with adequate help. Information on what types you want to use the filter for and what UI you want would be very helpful.

    I am looking forward to you reply.

    Kind regards,
    Ivan Petrov
    the Telerik teamQ3’11 of RadControls for WinForms is available for download (see what's new). Get it today.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 19 Dec 2011 Link to this post

    Similar to how the dates are group, I would like to group dollar amounts, e.g "$5 to $10 million" or ">$10 million".  Another example would be a state column, but instead of only showing states existing in the data, I would like to show all states.  Also below the state list, I would like to display checkboxes for East, West, etc.

    On a similar note, is there a way I can replace the controls in the filter cell for a column?  If that was possible, that would go a long way as well. 
  5. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 22 Dec 2011 Link to this post

    Hello Jason,

    Thank you for writing back 

    Currently, the filter popup does not allow for adding custom items, but we have planned to improve this and allow developers to fully customize the list with items and the filter descriptors the popup produces. In this line of thoughts we would very much appreciate any feedback you share with us about other scenarios you would like to be able to accomplish with the filter popup and features you want to see.

    On your second question. You can customize the filter cell with elements you choose. Please find attached a sample project where I have created a custom cell with a button and a check box which replaces the default filter cell.

    I hope this will be useful for you. Should you need further assistance, I would be glad to provide it.

    All the best,
    Ivan Petrov
    the Telerik team

    Q3’11
    of RadControls for WinForms is available for download (see what's new). Get it today.
  6. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 22 Dec 2011 Link to this post

    Thank you for the code sample.  I believe I can use that method instead of the popup.  Two questions though....1) How does my custom class actually apply the filter?  Does it need to raise an event?   2)  I noticed that if I group on that field and then ungroup, I lose the customization.  What event should I capture to ensure it's applied again?

    Thank you!
  7. Svett
    Admin
    Svett avatar
    728 posts

    Posted 27 Dec 2011 Link to this post

    Hi Jason,

    Here are the answers to your questions:
    1. You should perform filtering by modifying the FilterDescriptors collection. You can read more about how you can perform filtering programmatically in the online documentation.
    2. I am not able to reproduce the issue with 2011.3 11.1116 version. Nevertheless, you can improve the custom cell element by overriding the IsComaptible method:
    public override bool IsCompatible(GridViewColumn data, object context)
    {
        return data is GridViewDataColumn && context is GridFilterRowElement;
    }

    If the proposed solution does not address the second issue, could you illustrate the exact steps that we should follow to reproduce it? This will allow us to investigate it and provide you with further support. Greetings,
    Svett
    the Telerik teamQ3’11 of RadControls for WinForms is available for download (see what's new). Get it today.
  8. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 27 Dec 2011 Link to this post

    I am currently using version 2011.3.11.1219.  

    The CreateCell event is not fired after ungrouping by a column, so it appears it loses it's CellType upon grouping.


  9. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 30 Dec 2011 Link to this post

    Hi Jason,

    Thank you for writing back.

    I have attached a modified version of the example I previously sent you. In it I have added logic which applies a filter on the column when you check the check box. When you group and ungroup the filter is preserved as well as the toggle state of the check box. If this is not what you had in mind I would kindly ask you to provide some more details on what the example does not achieve.

    Looking forward to your reply.
     
    All the best,
    Ivan Petrov
    the Telerik teamSP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).
  10. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 30 Dec 2011 Link to this post

    Thank you for the additional code.  This took me awhile to track down, and I believe it might be a bug somewhere.  Change your CreateCell event to only change the celltype of a specific column.  It will work fine until you ungroup. Any ideas???

    Try this code....

    private void radGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e)
    {
        if (object.ReferenceEquals(e.CellType, typeof(GridFilterCellElement)) && e.Column.HeaderText.ToUpper == "COLUMN 1") {
            e.CellType = typeof(MyGridFilterCellElement);
        }
    }
  11. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 04 Jan 2012 Link to this post

    Hello Jason Parrish,

    Thank you for your reply.

    The reason for this behavior is that the RadGridView uses a cache for the cells and when you ungroup it gets a filter cell from the cache from the previous column and it overrides your custom one. To fix this, I have added another custom cell which only inherits from the filter cell and in the IsCompatible method override it says that it is not compatible with the column you want a custom filter cell. I have also changed the class from which your custom cell inherits so the applying of a filter is done with just one method.

    I hope this will help. Should you need further assistance, I would be glad to provide it.

    All the best,
    Ivan Petrov
    the Telerik team

    SP1
    of Q3’11 of RadControls for WinForms is available for download (see what's new).
Back to Top
UI for WinForms is Visual Studio 2017 Ready