Return value of custom function into a datasource used in a Kendo grid


Given a kendo grid that use a datasource that has as c3function:“retieveBatchLabel”

reteieveBatchLabel is a function I declared into RevenueOpportunity
In the function I create a generic object that contains as fields the result of different fetches on different types.

In order to display the object properly in the kendo grid - should the function declaration expect a return value or not?
Actually I declared
retrieveBatchLabel: function(spec: FetchSpec): js server
and I do a outcomeArray.push(ro);

and within the function I simply do the return of the array of generic objects and in the kendo grid into the “filed” I’ve put the fields of the object. so far the anything show up



it’s better to return a FetchResult.



In order for your function to return any data you need to declare a return value type.



ok thanks - assuming I’ll return a FetchResult then in the Kendo grid should I put somethting like

returnedObject.objs.field1 to show the field?



You will have a collection or better a DataSource like this:

ui module TheModule {
    dataSource BatchLabels {
        "c3type": "RevenueOpportunity",
        "c3function": "retieveBatchLabel"
        "responseSelector": "objs",
        "c3arguments": {
           "spec": {
                "include": "",
                "filter": "",
                 . . .
                "limit": -1

Then in your page or component, use this data source:

        "data": {
            "collection" : "TheModule.BatchLabels"
        "rowIdField": "id",
        "columns" : [
                "label": "the name",
                "field": "name",
                "format": "...",
                "sortable": true,

How to set the default sorted column on a KendoGrid