I have a Kendo Grid in ASP.NET MVC and I've grouped my datas.
@(Html.Kendo().Grid<Correspondent>(Model.Correspondents)
.Columns(columns =>
{
columns.Bound(p => p.Service)
.Title("Service")
.Hidden(true);
columns.Bound(p => p.Name)
.Title("Name")
.ClientTemplate(RenderCorrespondentName().ToHtmlString());
})
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Group(groups => groups.Add(p => p.Service))
)
)
We can see that I'm grouping my datas by service.
Now, and I can't find a way to do it, is to sort thoses services in a specific order : I'd like one service to always come last.
I've seen somewhere that you can specify an order for your grouping if you pass a list of items in the right order. In my case I do not know what I can get in the service : What I know is I might have a service that is null (Or "None") and if so, I'd like to put this group at the end.
Sorry for potential grammatical errors, I hope I was clear enough.
Thanks in advance.
So I suceeded in what I wanted to do in a very cheeky way.
As I saw that the groups where sorted in ascending order I named my specific service "ZZZ" so that he would be at the end of the list, then in JavaScript I find and edit the "ZZZ" in what I wanted, in this case "Other".