Bind searchable text on column for ShowSearchPanel

6 posts, 1 answers
  1. Inger Marie
    Inger Marie avatar
    60 posts
    Member since:
    Nov 2010

    Posted 17 Jun Link to this post

    I have a column which shows the state of my object in colors. It also shows a short name as text. The grouping and sorting works on the state, which is an enum.

    I would want the text search (as in RadGridView.ShowSearchPanel) to search for the short name.

    Is there a setting on the column that lets me do this?

     

    (I really do not want to change the DataMemberBinding which binds to the state, because the looks and function of the cell is in styles and templates, which are reused all over my applications).

     

    Thanks,

    Inger Marie

  2. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    277 posts

    Posted 20 Jun Link to this post

    Hello Inger,

    I suggest you add another property of  your object that returns the short name as a string. Eventually, you can bind the column to that string property so that the Search Panel functionality works as expected. You can set the SortMemberPath and GroupMemberPath properties of the column to the enum property:

    <telerik:GridViewDataColumn DataMemberBinding="{Binding ShortName}"
      Header="State"
      SortMemberPath="State"
      GroupMemberPath="State"/>

    I have added a sample project for your reference. Please review it and update the thread whether such approach would work for you.

    Regards,
    Stefan Nenchev
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Inger Marie
    Inger Marie avatar
    60 posts
    Member since:
    Nov 2010

    Posted 20 Jun in reply to Stefan Nenchev Link to this post

    As I wrote, I really need a solution that does not change the DataMemberBinding.

    The problem with your approach is that I use the (complex) object of the DataMemberBinding to determine state - it is used to set the background color of the cell, to show or hide certain text in the cell etc.

    Am I to understand from your reply, that setting the textsearch-text is not possible without setting the datamemberbinding?

     

  5. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    277 posts

    Posted 22 Jun Link to this post

    Hello Inger,

    Indeed, the SearchPanel is designed to work in such manner when the type of the bound property is an Enum so it is not possible to achieve the behavior without changing the binding. Having the SearchPanel filtering applied to a column of type enum seems useful, though, so I have logged it as a feature request. You can follow its progress in our Ideas & Feedback portal - SearchPanel: Add Support for columns of type Enum. You can vote for the item in order to increase its priority.

    In the meantime, you should be able to achieve the additional modifications for the cell by using a CellStyleSelector. Please review the following article from our documentation - CellStyleSelector and CellTemplateSelector. Would such approach work for you? I have updated the sample project with the approach.

    Regards,
    Stefan Nenchev
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  6. Inger Marie
    Inger Marie avatar
    60 posts
    Member since:
    Nov 2010

    Posted 22 Jun in reply to Stefan Nenchev Link to this post

    Seems like a good idea to allow search for enumerations. However, the screen name of the enumeration is localilzed so we use an attached attribute on the enumeration value to get the screeen name which is actually saved in a ressource file - which means that converters should be applicable.

    Also, I am not sure if you understand the problem correctly.

    The "thing" I have in the cell is a bit complicated.

    * It can have 1 of 8 states (enumeration). The 8 states makes out the different stages of the life cycle. The background color of the cell is dependent on the state - and it is used for sorting and grouping.

    * It can be 1 of 3 types (enumeration).The type is shown by a dot in the middle of the cell (color varies and the dot may not be present).

    * It may be associated with another object which has a name property (text). The value of the name property is shown as a text in front of the dot.

    I do not want to text search for state or type (because they are viewed as forms and colors by the user). But I would like the text search for the related property name.

    This request is not mission critical for me - I (and certainly my users) can live without it. It just seemed like a nice touch.

     

    Thanks,

    Inger Marie

  7. Answer
    Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    277 posts

    Posted 23 Jun Link to this post

    Hi Inger Marie,

    Thank you for the detailed explanation.

    Indeed, the approach suggested in my previous reply does not seem that straightforward in your specific case as you have a more complex setup and as I am not thoroughly familiar with it, it`s hard for me to represent it in the sample project. I am glad to hear that the feature is not that critical for your application. As discussed, we have the functionality logged so we will evaluate its priority and respectively consider implementing it at some point. Thanks for leaving the comment as well so we can have it in mind. 
    I have also added 1000 Telerik points to your account for reporting the behavior and contributing to the quality of the product.
     
    Regards,
    Stefan Nenchev
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for WPF is Visual Studio 2017 Ready