Fetch data in a custom function

#1

I have in a Kendo Grid a field where I want to apply a custom function “MyCustomFunction.js”-

  1. is it possible to fetch data on a type in a custom function? So ServicePoint.fetch({filter: Filter.eq(“id”,data.id)})?
  2. in my c3funk should I declare something like below?

{
“id”: “myField”,
“label”: “{~blabla~}”,
“field”: “myField”,
“format”:
“funk”: “myCustomFunction”
}
},
“width”: 85
}

0 Likes

#2

funk accepts a javascript function, you can pass in whatever arguments you want and generate the result you want! For instance

  var helpers = C3.script.helpers;
  _.extend(helpers, {
    /**
     * @param {string} arg1 
     */
    myCustomFunction: function(arg1, arg2, ....) { 
      c3args = new C3.network.Arguments({spec: {...}}).render();
      var result = new C3.network.C3Request({
        c3type: 'ServicePoint',
        c3function: 'fetch',
        c3arguments: c3args,
      ...
      }
      )
     // do something
      return result;
    }
  });

However this may end up to be too slow as you have to go over the network for every row. It would be better to use a secondary DataSource for your grid like in the following thread:

0 Likes