or
define([
"kendo"
,
"app/data"
],
function
(kendo, data) {
return
{
viewModel: kendo.observable({
myData: data.myData
})
}
});
define([
"jQuery"
,
"kendo"
,
"app/environment"
,
"app/utils"
],
function
($, kendo, config, utils) {
var
DataSourceConfig =
function
(url, sortField, options) {
this
.transport = {
read:
{
url: url,
dataType:
'jsonp'
,
}
}
this
.sort = {
field: sortField,
dir:
"asc"
};
$.extend(
this
, options || {});
};
DataSourceConfig.prototype = {
type:
"GET"
,
requestStart:
function
() {
if
(
this
.pageSize() === undefined ||
this
.page() === 1) { utils.showLoading(); } },
//infinite scrolling has its own, less obtrusive indicator
requestEnd:
function
() { utils.hideLoading(); },
error:
function
() { utils.hideLoading(); utils.showError(
"There was an error loading the data from the server. Please close the app and try again."
); }
};
return
{
clear:
function
(dataSource) {
dataSource.view().splice(0, dataSource.view().length);
},
myData:
new
kendo.data.DataSource(
new
DataSourceConfig(config.myDataUrl)),
};
});