<div id="Grid"></div>
<script>
$.ajax({
type: 'GET',
url: "/Grid/LoadGridData",
data: { searchString: "Brazil", groupByColumn: 'EmployeeID' },
success: function (result) {
$('#Grid').ejGrid({
dataSource: ej.parseJSON(result),
isResponsive: true,
----------------------
groupSettings: { groupedColumn: "EmployeeID" },
columns:
[
{ field: "OrderID", headerText: "ID", isPrimaryKey: true, headerTextAligh: "right", width: 30 },
{ field: "CustomerID", headerText: "Serial Number", width: 60 },
{ field: "EmployeeID", headerText: "Link Station", width: 50 },
{ field: "OrderDate", headerText: "Date Linked", priority: 2, format: "{0:dd/MM/yyyy}", width: 40 },
],
recordClick: function (args) { }
});
},
complete: function () {
}
});
</script>
------------------------------------------------
[HttpGet]
public ActionResult LoadGridData(string searchString, string groupByColumn)
{
if (String.IsNullOrEmpty(searchString))
{
return Json("FAILED", JsonRequestBehavior.AllowGet);
}
ViewBag.SerialNo = searchString;
List<EditableOrder> linkedItems = OrderRepository.GetAllRecords().Take(10).ToList();
ViewBag.GroupByColumn = (string)groupByColumn;
return Json(linkedItems, JsonRequestBehavior.AllowGet);
} |