Hello, I am trying to access my datasource after I read it in remotely. The problem is that it thinks that my datasource is undefined. I am pretty sure I am using the proper syntax because when I check the data in the change() event, it shows all the data correctly and I can access each field. But when i try to do it outside of the code it doesn't work. Here is my code and the errors I am getting. PLEASE HELP!
PlayerCalculatorModule.prototype.initialize = function() {
'use_strict';
var self = this;
var calcData;
this.eventModel = kendo.data.Model.define({
id: "playerGUID",
playerFirstName: "playerFirstName",
playerLastName: "playerLastName",
pricePerTd: "pricePerTd",
pricePerYard: "pricePerYard",
pricePerFumble: "pricePerFumble",
pricePerSacked: "pricePerSacked",
pricePerIncompletion: "pricePerIncompletion",
pricePerInterception: "pricePerInterception",
pricePerCompletetion: "pricePerCompletetion",
playerStartingPrice: "playerStartingPrice"
});
this.calcData = new kendo.data.DataSource({
transport: {
read: {
// the remote service url
url: "/Market/ServiceBeans/playerCalcService.jsp",
// JSONP is required for cross-domain AJAX
dataType: "json",
// additional parameters sent to the remote service
data: { //additional parameters sent to the remote service
action: "getEvents"
}
}
},
change: function () { // subscribe to the CHANGE event of the data source
console.log(this.data());
}
});
this.calcData.read();
console.log(this.calcData.data());
};
The first time I call console.log(this.data()); Everything works as it should. But when i call :
console.log(this.calcData.data()); It thinks i have no data.
Here are is the console output:
- _events: Object
- length: 0
- parent: function (){return t._parent()}
- type: function (e){var t,n,i,r=this,a=function(){return r};U.fn.init.call(this);for(n in e)t=e[n],"_"!=n.charAt(0)&&(i=ft.call(t),t=r.wrap(t,n,a)),r[n]=t;r.uid=L.guid()}
- __proto__: Class.extend.i
^^^^^ This is the bad return, it should have a length of not 0
- [0 … 99]
- [100 … 168]
- _events: Object
- length: 169
- parent: function (){return t._parent()}
- type: function (e){var t,n,i,r=this,a=function(){return r};U.fn.init.call(this);for(n in e)t=e[n],"_"!=n.charAt(0)&&(i=ft.call(t),t=r.wrap(t,n,a)),r[n]=t;r.uid=L.guid()}
- __proto__: Class.extend.i
^^^^^ This is the correct output it has all of my objects and their fields within each.
Any help is greatly appreciated, I am really stuck on this one.