How to enable sorting in a KendoGrid for columns added by child DataSource


I’ve a KendoGrid with columns populated from a main DataSource that fetches instances of the Facility type. Now I’ve added an additional column ranking with values populated with a mappingHelper function and a child DataSource.
This is how I define the column in the grid:

    "label": "raking",
    "field": "ranking",
    "align": "center",
    "sortable": true,
    "id": "ranking"

When the KendoGrid is rendered, the values of this column ranking are populated, however when I click on the column name to sort the rows with the values in it I hit the following error:

wrapped RuntimeException: Field 'ranking' does not exist in expression: '[ranking]' for type 'Facility'

How I get the KendoGrid to enable sorting for this column ranking which does not exist as a field in Facility but is rather added by child DataSource?


You’ll need a custom action to capture clickColumnHeader event on KendoGrid.
That action should update the Collection filter order and request the data.


I have the same issue, but i can’t find anything about the clickColumnHeader event on KendoGrid. How can i manage this?

EDIT: i figured out how to handle the click over the table header and retrieve the collection.
What i’m missing now is this part:

update the Collection filter order and request the data