We tried to implement the solution given at http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/foreign-key-column-sorting-by-text . but this solution is working at client side but it is not working at server side application.
Do we have any way to achieve this?
5 Answers, 1 is accepted
We appreciate if you can provide us code segment equivalent to this script which can be used in views (MVC)?
The same approach is not applicable for the MVC wrapper due to the way how MVC wrappers are being configured. There is no way to configure a calculated column in the DataSource configuration with the razor.
A possible workaround would be to have a custom column (hidden in the UI) that holds the text for each Category (the foreign key itself is bound to the integer column). When user tries to sort the foreign key you can explicitly sort the DataSouce by the hidden column. Please refer to the code snippets below:
Please note that such scenario is not officially supported and some custom logic should be implemented. In the example above it is shown some sample code that does not include validation logic and etc.
Thank you for your reply. The answer you provided would be definitely useful but it is just doing Descending on click of the column header but not Ascending. And up and down arrows on the column header are missing. Can you please extend the answer to full fill these requirements since usually everybody needs it.
The sort of the foreignkey column by the text and not the ID has been discussed in the forum thread below:
Give the approach above a try and let me know if there is a need for additional details.