I am trying to add sorting inside grouped columns, So the Grid is grouped by X and Y columns and then I need to sort for the rows in it.
I need to sort by CustomSortIntegerValue if CustomSort = true, and Alphabetically by Name if CustomSort = false. The last line does not work. Can you please give an pointers/examples on how to achieve this.
@(Html.Telerik().Grid(Model)
.Name("Grid")
.NoRecordsTemplate("Loading ..... Please Wait")
.Columns(c =>
{
c.Bound(x => x.Name).Title("Name");
c.Bound(x => x.CustomSortIntegerValue).Title("Custom Sort");
c.Bound(x => x.Id).ClientTemplate(Html.ActionLink("Edit", "Edit", new { id = "<#=Id#>" }).ToString()).Filterable(false).Sortable(false).Title("").Width(50);
})
.DataKeys(keys =>
{
keys.Add(x => x.Id);
})
.DataBinding(dataBinding => dataBinding.Ajax()
.OperationMode(GridOperationMode.Client)
.Select("RetrieveAllData_AjaxBinding", "CDController"))
.Groupable(grouping => grouping.Groups(groups =>
{
groups.Add(x => x.X);
groups.Add(x => x.Y);
}).Visible(false))
//.Sortable(sort => sort.OrderBy(sortOrder => sortOrder.Add(x => x.CustomSort ? "CustomSortIntegerValue" : "Name").Ascending()).Enabled(false))
)
I need to sort by CustomSortIntegerValue if CustomSort = true, and Alphabetically by Name if CustomSort = false. The last line does not work. Can you please give an pointers/examples on how to achieve this.
@(Html.Telerik().Grid(Model)
.Name("Grid")
.NoRecordsTemplate("Loading ..... Please Wait")
.Columns(c =>
{
c.Bound(x => x.Name).Title("Name");
c.Bound(x => x.CustomSortIntegerValue).Title("Custom Sort");
c.Bound(x => x.Id).ClientTemplate(Html.ActionLink("Edit", "Edit", new { id = "<#=Id#>" }).ToString()).Filterable(false).Sortable(false).Title("").Width(50);
})
.DataKeys(keys =>
{
keys.Add(x => x.Id);
})
.DataBinding(dataBinding => dataBinding.Ajax()
.OperationMode(GridOperationMode.Client)
.Select("RetrieveAllData_AjaxBinding", "CDController"))
.Groupable(grouping => grouping.Groups(groups =>
{
groups.Add(x => x.X);
groups.Add(x => x.Y);
}).Visible(false))
//.Sortable(sort => sort.OrderBy(sortOrder => sortOrder.Add(x => x.CustomSort ? "CustomSortIntegerValue" : "Name").Ascending()).Enabled(false))
)