如何在Kendo ASP.NET MVC中以特定顺序分组
我在 ASP.NET MVC 中有一个 Kendo Grid,并且我已经对数据进行了分组。
@(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))
)
)
我们可以看到我正在按服务对数据进行分组。
现在,我找不到一种方法来做到这一点,就是按特定顺序对这些服务进行排序:我希望一项服务始终排在最后。
我在某处看到,如果您以正确的顺序传递项目列表,则可以指定分组顺序。就我而言,我不知道我可以在服务中获得什么:我所知道的是我可能有一个为空(或“无”)的服务,如果是这样,我想将此组放在最后。
抱歉可能存在语法错误,我希望我说得足够清楚。
提前致谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,我以一种非常厚脸皮的方式取得了想做的事情。
当我看到以上排序顺序排序的小组中,我将特定的服务命名为“ zzz”,以便他在列表的末端,然后在JavaScript中,我找到并编辑了我想要的“ zzz”,在这种情况下“其他”。
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".