We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Sort and Filter by Nested Objects

I have the following grid, and i am wondering if it is possible to sort or filter by objects nested in objects. The second coloum i define is what i am trying to sort and filter by with no luck. i get no results back at all.
*** VIEW
@(Html.EJ().DataManager("FlatData").URL(Url.Action("GlobalDataSource", "Home", null, Request.Url.Scheme)).Adaptor(AdaptorType.UrlAdaptor))
@(Html.EJ().Grid("Grid")
.DataManagerID("FlatData")
.AllowPaging()
.AllowSorting()
.AllowMultiSorting()
.AllowFiltering()
.AllowSearching()
.ContextMenuSettings(contextMenu =>
{
contextMenu.EnableContextMenu();
})
.Columns(c =>
{
c.Field(f => f.ID).Width("7%").Add();
c.Field(f => f.Company.CompanyName).Width("15%").Add();
c.Field(f => f.TicketDisplayID).Width("15%").Add();
c.Field(f => f.CreateDate).Width("10%").Add();
c.Field(f => f.ClosedDate).Width("10%").Add();
c.Field(f => f.ServiceItem).Width("10%").Add();
c.Field(f => f.Desc).Width("13%").Add();
c.Field(f => f.RespPartyResolutionTypeId).Width("10%").Add();
c.Field(f => f.Parent).Width("10%").Add();
})
.SortSettings(sort => sort.SortedColumns(col => col.Field("ID").Direction(SortOrder.Descending).Add()))
.PageSettings(p => p.PageSize(30).EnableQueryString())
.ClientSideEvents(e => e
.Create("create")
.ActionComplete("onComplete")
.ActionBegin("actionBegin")
))
**** CONTROLLER
public ActionResult GlobalDataSource(Syncfusion.JavaScript.DataManager dm)
{
IEnumerable data = db.GlobalTicketInfo;
Syncfusion.JavaScript.DataSources.DataOperations operation = new Syncfusion.JavaScript.DataSources.DataOperations();
if (dm.Sorted != null && dm.Sorted.Count > 0)
{
data = operation.PerformSorting(data, dm.Sorted);
}
if (dm.Where != null && dm.Where.Count > 0)
{
data = operation.PerformWhereFilter(data, dm.Where, dm.Where[0].Operator);
}
int count = data.AsQueryable().Count();
if (dm.Skip != 0)
{
data = operation.PerformSkip(data, dm.Skip);
}
if (dm.Take != 0)
{
data = operation.PerformTake(data, dm.Take);
}
return Json(new { result = data, count = count }, JsonRequestBehavior.AllowGet);
}

1 Reply

JK Jayaprakash Kamaraj Syncfusion Team December 21, 2016 12:25 PM UTC

Hi Diamond, 
 
A support incident has been created under your account to resolve the issue. Please log on to our support website to check for further updates.  
 
Regards,
Jayaprakash K.
 


Loader.
Live Chat Icon For mobile
Up arrow icon