开发者

mvc contrib grid

开发者 https://www.devze.com 2023-01-07 20:05 出处:网络
I am just wondering whether it is possible to sort by \'combined columns\' now (mvc contrib grid)? I know it says here that it is not possible - at least at the time of posting at this site - but thi

I am just wondering whether it is possible to sort by 'combined columns' now (mvc contrib grid)?

I know it says here that it is not possible - at least at the time of posting at this site - but things might have changed in the meantime.

This is an example of a combined column in the view:

column.For(x => String.Format("{0} {1}", x.Proposer.LastName, x.Proposer.FirstName)).Named("Proposer");

Ideally I would like to sort by 'LastName' in this case.

Thanks.

Christian

PS: The main problem is that sort.Column is null for 'combined columns' when the GET req开发者_如何学编程uest hits the controller. Perhaps there is a way to rectify this


Unfortunately, not at this time, as you said.

Why not make a ViewModel that had the column you are creating? Since the sort code is dependent on the columns in the model (and not the client-side generated ones), it would be sortable when it posts back.

0

精彩评论

暂无评论...
验证码 换一张
取 消