MVCContrib grid - sort a custom column

Just started learning how to use the grid, so please excuse me for a possible trivial question.

How can I sort by column that uses another table property? E.g.
column.For(cust => cust.LinkedTable.someProperty).Sortable(true);
determination results in "Could not find the property" someProperty "in the type" MyProject.Models.Node "error (obvious - the property is actually MyProject.Models.Node.LinkedTable.someProperty)

One of my ideas was to create an assistant:

column.For(cust => Helpers.ViewHelper.GetSomeProperty(cust)).Sortable(true);

This does not result in an error, but the columns are not sorted in any way.

In other words, is there a way to pass a string value to a column and make it sorted?

Gotta rewrite my sorting function (now just OrderBy (...)), but I don't know how to start :) Any help would be appreciated!

+3
source share
2 answers

I would recommend you a jQuery grid

Check it out, it is very useful.

0
source

You can do it as follows:

column.For(cust => cust.LinkedTable.someProperty).SortColumnName(somePropertyID)

where somePropertyIDis the attribute of the table cust.

+3
source

Source: https://habr.com/ru/post/1764647/


All Articles