schema.parse asynchronous execution

2 posts, 0 answers
  1. pixi
    pixi avatar
    2 posts
    Member since:
    Sep 2015

    Posted 22 Sep 2015 Link to this post


    First of all I'm using Kendo UI with AngularJS.

    I use schema.parse function to reprocess the results. However, the issue I've is that in parse function I manually overwrite some columns ​with a call from a angular service, which returns promise. The columns which are overwritten via promise are not defined. You can easily imagine that via this example:

    - I define two fields: code: {type: 'number'}, name: {type: 'string'}

    - Via API call only code is obtained (name is undefined)

    - in parse function I call a service which obtains me name (code parameter is passed into it).


    Example of parse function:

    parse: function(data) {
        // = 'test'; // THIS WORKS{
       = result; //DOESN'T WORK
        return data;


    Any possibility to achieve the wanted behaviour? Or some other option to be sure that dependant data can be provided manually (so not via API)?

  2. Rosen
    Rosen avatar
    3247 posts

    Posted 24 Sep 2015 Link to this post

    Hello pixi,

    I'm afraid that this will not work. The parse function is synchronous, thus when the asynchronous call completes the execution of the parse function has already completed. The data from the parse function is used to construct the ObservableObject instances returned by the DataSource. Thus, modifying the original data at later stage (which is what happens in the code snippet) will not have effect on the DataSource data.

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top