Automatic Grouping / Filtering does not work

5 posts, 0 answers
  1. Deven
    Deven avatar
    33 posts
    Member since:
    Apr 2009

    Posted 08 Jun 2009 Link to this post

    Hi,
    I bind the grid as follows, does not allow me to group or filter on "Category" column. The data I am binding to it is a lookup class. The binding works perfectly, however the grouping  and filtering on that column is not available. 

     

     

    <telerikGridView:RadGridView.Columns>

     

     

     

    <telerikGridView:GridViewDataColumn HeaderText="Year" DataMemberPath="AcademicYear"/>

     

     

     

    <telerikGridView:GridViewDataColumn HeaderText="Category" IsGroupable="True" DataMemberPath="Category.CodeDes"/>

     

     

     

    <telerikGridView:GridViewDataColumn HeaderText="Days" DataMemberPath="EffectiveDays"/>

     

     

     

    <telerikGridView:GridViewDataColumn HeaderText="Occurance" DataMemberPath="Occurances"/>

     

     

     

    </telerikGridView:RadGridView.Columns>

     



    Please help.
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 08 Jun 2009 Link to this post

    Hello Deven,

    You may need to implement IComparable and IEquatable<> for this property.

    Regards,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Deven
    Deven avatar
    33 posts
    Member since:
    Apr 2009

    Posted 08 Jun 2009 Link to this post

    Vlad, thanks for your quick reply.
    Since I cannot modify the actual class, I implemented a partial class in to my project as following, it still wont work. FYI CodeDes is string property.

    public

     

    partial class Category : IEquatable<string>, IComparable<string>

     

     

     {

     

    #region IEquatable<string> Members

     

        public bool Equals(string other)

     

            {

    return this.CodeDes == other; }

     

     

     

    #endregion

    #region

     

    IComparable<string> Members

     

     

        public int CompareTo(string other)

     

            {

    return this.CodeDes.CompareTo(other); }

     

     

    #endregion

    }

  4. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 11 Jun 2009 Link to this post

    Hello Deven,

    I've attached small example to illustrate you this. Although groping will work with simple IEquatable<> implementation looks like you will need to define equality operators to handle filtering - this was a bit unexpected since we thought that LINQ will handle this automatically.

    Let me know how it goes.

    Kind regards,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Deven
    Deven avatar
    33 posts
    Member since:
    Apr 2009

    Posted 17 Jun 2009 Link to this post

    Sorry for late reply. I took another route. I extended my entity with a property that will read description from the complex type. Since it was just one-off I was able to make this decision. I have not got a chance to look at your solution, but I promise when I hit back into this situation I will surely check it out.

    Many thanks.
    Deven
Back to Top