02.Nov.15

Milan Nankov

Milan Nankov

Code Bites: Parsing Server Response With Kendo DataSource

This is the first edition of a new category of blog posts called Code Bites were we will provide quick solutions, tips and tricks, and interesting ideas related to the various technologies that we use.

The first Code Bite is about parsing server response data when working with Kendo DataSource. Sometimes we need to process the server response and massage the data that we want to work with. For example, combining multiple fields into a single one, calculating some value or cleaning up some data. In order to do that with Kendo DataSource we use the schema.parse function. Let's assume that we are calling a service that returns user entities with first name and last name properties but we want to combine those two into a single one called fullname. Easy as pie:

The schema.parse function accepts a single argument which is the original server response. Whatever is returned from that function will be used as data of the DataSource.

Cheers.
 

Need consulting on this topic?

Yes No