This is a migrated thread and some comments may be shown as answers.

Access json data in Completed event

2 Answers 138 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 04 Sep 2012, 03:30 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Lothar
Top achievements
Rank 1
answered on 07 Sep 2012, 08:02 AM
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
0
William
Top achievements
Rank 1
answered on 07 Sep 2012, 05:00 PM
Lothar,

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

Wade
Tags
Data Source
Asked by
William
Top achievements
Rank 1
Answers by
Lothar
Top achievements
Rank 1
William
Top achievements
Rank 1
Share this question
or