Access json data in Completed event

3 posts, 1 answers
  1. William
    William avatar
    23 posts
    Member since:
    Jan 2012

    Posted 04 Sep 2012 Link to this post

    This might be an odd question, but I am using the datasource object to get data from the server for my grid, but there is additional information I want to display elsewhere.  Right now I get the list of results, the total count, and a count of customers contacted.  I want to display this number in a span for the user to work with, but I don't know where this information is stored or even if it is stored when the datasource completed event is fired.  Any help would be appreciated
  2. Answer
    Lothar
    Lothar avatar
    4 posts
    Member since:
    Jul 2012

    Posted 07 Sep 2012 Link to this post

    I'm not an expert, but this should give you access to whatever the server is returning back to the client:

    new kendo.data.DataSource({
        transport: {
                    read: {
                        url: "/urlToCall",
                        dataType: "json",
                        type: "GET",
                        complete: function(data,xhr){
                            result = JSON.parse(data.responseText);
                            // this result object is what is returned from server
                        }
                    }
        },
        schema: {}
    }

    Work for me in update transport. Good luck
  3. Kendo UI is VS 2017 Ready
  4. William
    William avatar
    23 posts
    Member since:
    Jan 2012

    Posted 07 Sep 2012 Link to this post

    Lothar,

    Well that worked, though it took me a bit to realize that JSON.parse comes from another library.  Still, thanks.

    Wade
Back to Top