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

kendo ui grid, Server Side Filter & Sorting on Foreing Key Column(which is ID)

1 Answer 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
N
Top achievements
Rank 1
N asked on 13 Jan 2014, 07:10 PM
I have Two scenarios, where i want to provide filtering, which does not have direct Mapping with Table column Field.
1) First one i am using Foreign Key Column with Combo Editior, this column is also using Template to display Name isntead of IDs.
  so the Table Relationship is like this, degree has DegreeCategoryID_FK  & joins to DegreeCategory's  DegreeCategoryID_PK Column.

On the Server WebAPI Read method Looks like
==========================================================================================================================
  public PageResult<Degree> GetDegrees(ODataQueryOptions<Degree> options)
        {
            IQueryable results = options.ApplyTo(db.Degrees.Include(dc => dc.DegreeCategory));

            return new PageResult<Degree>(
                results as IEnumerable<Degree>,
                Request.GetNextPageLink(),
                Request.GetInlineCount());

        }
==========================================================================================================================

So when user filters on this Column, it should actually translate that filter to DegreeCategory.Name on the server. 
How can i achieve this ?

The following is in Degree Grid
   {
                                    field: "DegreeCategoryID_FK",
                                    title: "DegreeCategory",
                                    width: 140,
                                    editor: DegreeCategoryComboEditor,
                                    template: function (dataItem) {
                                        //if (window.SelectedDegree != null) {
                                        //    dataItem.DGID_FK = window.SelectedDegree.DGID_PK;
                                        //    return window.SelectedDegree.Name;
                                        //}
                                        //else
                                        //    return "";
                                        return GetdegreeCategoryName(dataItem.DegreeCategoryID_FK, dataItem.DegreeCategory.CategoryName);
                                    }
                                },

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 15 Jan 2014, 02:33 PM
Hello,

 If you customize the filter UI like shown here:

http://demos.kendoui.com/web/grid/filter-menu-customization.html

The value of the filter descriptor will be whatever the value of the element inside the filter ui is.

I hope this is what you are searching for.

Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
N
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or