Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
143523 | Mar 25,2019 10:54 AM UTC | Mar 26,2019 06:42 AM UTC | ASP.NET MVC - EJ 2 | 1 |
![]() |
Tags: Grid |
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.DataSource).Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).Width("120").Add();
col.Field("CustomerID").HeaderText("Customer Name").Width("150").SortComparer("sortComparer").Add(); //SortComparer applied for the column to be grouped initially
col.Field("ShipName").HeaderText("ShipName").Width("150").Add();
})...
.SortSettings(sort => sort.Columns(new List<object>
{ new { field = "OrderID", direction = "Ascending" }, new { field = "ShipName", direction = "Ascending" } })).AllowMultiSorting()
.GroupSettings(group => { group.Columns(new string[] { "CustomerID" }); }).Render()
<script>
function sortComparer(reference, comparer) {
//Here you can define your custom sort function
return -1; //return -1 will restrict the sort
};
</script>
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.