Take a look at the data source fetch method in kendo.data.js
; in essence, it does something like this:
fetch: function (callback) {
var that = this;
...
if (fetchSuccessful) {
if (callback) {
// as you can see here, when invoking your callback,
// the code binds "this" to the data source instance
// you called .fetch() on
callback.call(that, e);
}
}
},
This pattern is used in many other methods which accept callbacks - with Kendo UI, you can in general expect this
to be the widget you called a method on.
Your other call works because you reference the GamesListViewModel
variable instead of this
. You could also do:
GamesListViewModel.set("gamesListDataSource", dataSource);