I am brand new to all of: ASP.NET, ASP.NET MVC2, and Syncfusion EssentialGrid. I am evaluating Syncfusion EssentialGrid for use in an ASP.NET MVC 2 application. I'm developing using Visual Studio 2010, language C#.
I can populate the grid with test data, no problem. But when I click on a column header cell the data in the grid does not sort. The form disables for a second or so, and a little sort indicator (sort of like ^ or V) appears next to the text of the column header. So the grid control seems to be "trying to sort".
Here is the critical method in my controller class. According to the docs it seems that the "" line is what I need to enable sorting.
// >>>>>>>>>>>>>>>>>>>>
public ActionResult OverviewByServer() {
ViewData["Message"] = "Overview by Server";
// read list
Models.AgentListByProperty al = new Models.AgentListByProperty("Server");
//List
allList = al.GetAgentList();
List sumList = al.GetSummaryList();
GridPropertiesModel gridModel =
new GridPropertiesModel() {
DataSource = sumList,
ShowCaption = false,
AutoFormat = Syncfusion.Mvc.Shared.Skins.Vista,
AllowSorting = true
};
ViewData["AgentSummaryByServer"] = gridModel;
ViewData["DefaultSkin"] = Syncfusion.Mvc.Shared.Skins.Vista;
//var data = sumList;
return View();
}
// <<<<<<<<<<<<<
The view in question is:
// >>>>>>>>>>>>>
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage>" %>
ByApplication
<%: ViewData["Message"] %>
<%=Html.Grid
("GridIndex")
.Datasource(Model)
.Column(column =>
{
column.Add(p => p.ByProperty).HeaderText("GroupBy");
column.Add(p => p.AgentsTotal).HeaderText("AgentTotal");
column.Add(p => p.AgentsInCall).HeaderText("InCall");
column.Add(p => p.AgentsReady).HeaderText("Ready");
column.Add(p => p.AgentsLoading).HeaderText("Loading");
column.Add(p => p.AgentsInErrorState).HeaderText("Error");
})
.EnableSorting()
%>
// <<<<<<<<<<<<<
One thing I tried was providing a sort method in the controller but that never gets called.
How do I get in-grid sorting to work? Failing that, how do I get sorting of any kind to work?