Hi,
i have a question regarding the DataSource.
I am using the code below. I don't have it in a separate file but in the <script> tag of the HTML. It's not the entire code either, that would probably be an unnecessary amount here. My problem concerns the valueOrderFinished. Inside the DataSource in the schema, the value is set. That works well, because when I set the innerhtml of #outputtest, the right value is displayed. But when I try to access it outside, in my document ready function, I always get that valueOrderFinihed is undefined.What I also don't understand, when I debug this code, it jumps from the transport part of the DataSource directly into my createCharts() function, and then back into the schema part of the DataSource.
I am really stumped and can't manage to solve the problem... can someone help me?
var showProfile = 0; var valueOrderFinished; [...] var dataSourceOrderFinished = new kendo.data.DataSource({ transport: { read: { url: "Services/OrderServices.asmx/GetCountOrderFinished", contentType: 'application/json; charset=utf-8', type: "POST" }, parameterMap: function (options) { return JSON.stringify({ parameter: options }); } }, schema: { data: function (result) { console.log(result.d.Count); document.getElementById("outputtest").innerHTML = result.d.Count; valueOrderFinished = result.d.Count; }, total: function (result) { return result.d.Count; } } } ); /* */ /* */ /* ++++ Funktionen ++++ */ $(document).ready(function () { console.log("dokument ready"); hideProfileElements(); console.log("Profilelemente versteckt"); valueOrderFinished = dataSourceOrderFinished.read(); console.log("datasource gelesen"); console.log(valueOrderFinished); createCharts(); }); [...]