cs0815
cs0815

Reputation: 17388

mvc contrib grid

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 request hits the controller. Perhaps there is a way to rectify this

Upvotes: 0

Views: 222

Answers (1)

Jonathan Bates
Jonathan Bates

Reputation: 1835

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.

Upvotes: 1

Related Questions