DataSource.RequestEnd() fires before request is complete

4 posts, 1 answers
  1. Vivek
    Vivek avatar
    5 posts
    Member since:
    Jan 2017

    Posted 30 Jan Link to this post

    I want to get the Id of the newly created task after the task has been successfully created. So, I am trying to get use the 'RequestEnd' event of dataSource to check if the event is of type 'create' and if the task id has been returned.

    Please see this snippet. and create a new task. It seems that there is no taskId present in the response.

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    1056 posts

    Posted 01 Feb Link to this post

    Hello Vivek,

    The id field in the DataSource is TaskID not taskId. So in the event handler you can change e.response[0].taskId to e.response[0].TaskID and the correct id value will be returned.
    Regards,
    Ivan Danchev
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Vivek
    Vivek avatar
    5 posts
    Member since:
    Jan 2017

    Posted 01 Feb in reply to Ivan Danchev Link to this post

    Hi Ivan,

    Thanks! That worked. But I am a bit confused. When I console.log() the response, the field shown for id is taskId. Can you explain why that's different?

  4. Answer
    Ivan Danchev
    Admin
    Ivan Danchev avatar
    1056 posts

    Posted 03 Feb Link to this post

    Hello Vivek,

    The JSON response from the remote service is lowercase, however when you try to access the field you should match its casing: in this case (TaskID):
    schema: {
                    model: {
                        id: "taskId",
                        fields: {
                            taskId: { from: "TaskID", type: "number" },


    Regards,
    Ivan Danchev
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top