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:
^^^^^ 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.
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]
[U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init, U.extend.init…]
^^^^^ 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.