We have the same problem as others with the sorting of foreignkey fields in the grid.
And it is still not solved...
Our workaround was to add the corresponding text value as a hidden column in the grid and in the Read Action we just replaced the Sorting Fields.
Something like that:
If we do so, the frontend looks like it would sort the foreign key column but actually the data is sorted by the text field. Exactly what we wanted. And yes we could extend the request to make it more generic, as someone has suggested in the link above, but we have another goal.
We want to include it in our Library and to do that the plan was to do it the following way:
(Please keep in mind that the code has only a prototype state! For example, it does not consider multiple dropdowns in a grid. And I did not copy all the code that is necessary, just the parts that are interesting.)
We created an own new Column Type “DropDown” for the Grid and now we can use it like that:
Now we can add a DisplayProperty and our code just added a hidden column for that DisplayProperty. (And the ClientTemplate)
And we add the information of the field in the ViewData for later reuse
This worked that fare. Therefore we expect to be on the right track. But now finally the part which we are not happy with:
back like that:
Is there a method for that? If not necessary we don’t want to implement it by our self to bring the sort, filter and group objects in the correct string based format.
Actually we just want to place something like that
read type at the beginning of the parameterMap method. The rest can run as
Generally, is this we do a recommend way, to do what we want? Or is there a better way? For example is the parameterMap the correct method?
And if we are on the right track, which method generates to correct stringifyed options including the translation of the arrays (sort, filter,..)?