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) 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);
}
},