Jquery KendoMobile MVVM kendo.observate,从JSON获取数据
我对如何从serwer json中检索数据有疑问。 我最初的想法是以MusicStore为例,帮助自己检索数据,我被卡住了 看法 正在检索数据Jquery KendoMobile MVVM kendo.observate,从JSON获取数据,jquery,json,mvvm,kendo-mobile,Jquery,Json,Mvvm,Kendo Mobile,我对如何从serwer json中检索数据有疑问。 我最初的想法是以MusicStore为例,帮助自己检索数据,我被卡住了 看法 正在检索数据 define(["jQuery", "kendo", "config", "utils"], function ($, kendo, config, utils) { var _wcfSchemaData = function (data) { return data.Data; }, _wcfSch
define(["jQuery", "kendo", "config", "utils"], function ($, kendo, config, utils) {
var _wcfSchemaData = function (data) {
return data.Data;
},
_wcfSchemaTotal = function (data) {
return data.Count;
};
var DataSourceConfig = function (url, sortField, options, dataType) {
this.transport = {
dataType: dataType,
read: url
};
//this.sort = {
// field: sortField,
// dir: "asc"
//};
//$.extend(this, options || {});
};
DataSourceConfig.prototype = {
//type: "json",
schema: {
data: _wcfSchemaData,
total: _wcfSchemaTotal
},
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."); }
};
//var EndlessScrollDataSource = kendo.data.DataSource.extend({
// _observe: function (data) {
// if (this._page > 1) {
// this._data.push.apply(this._data, data);
// return this._data;
// }
// return kendo.data.DataSource.prototype._observe.call(this, data);
// }
//});
return {
clear: function (dataSource) {
dataSource.view().splice(0, dataSource.view().length);
},
expositionsList: new kendo.data.DataSource(new DataSourceConfig(config.expositionUrl + "?lang=pl-PL", "Name",null,'json')),
};
});
我得到了一个错误。。。未捕获的TypeError:对象[Object Object]没有方法“调用”
我怎样才能解决这个问题,让它发挥作用
Jsonson在这里
Tx寻求帮助这方面运气好吗,Andrzej?我正试着做同样的事情。我的DataSourceConfig调用发生了,但它从未实际调用该服务。是的,我有完整的解决方案,我将在短时间内共享。@Andrzej Do share,我正在研究相同的问题。
define(["jQuery", "kendo", "data", "utils"], function ($, kendo, data, utils) {
return {
onShow: function (e) {
utils.log("expositions-view: onShow: " + e)
},
viewModel: kendo.observable({
expositions: data.expositionsList
})
};
});
define(["jQuery", "kendo", "config", "utils"], function ($, kendo, config, utils) {
var _wcfSchemaData = function (data) {
return data.Data;
},
_wcfSchemaTotal = function (data) {
return data.Count;
};
var DataSourceConfig = function (url, sortField, options, dataType) {
this.transport = {
dataType: dataType,
read: url
};
//this.sort = {
// field: sortField,
// dir: "asc"
//};
//$.extend(this, options || {});
};
DataSourceConfig.prototype = {
//type: "json",
schema: {
data: _wcfSchemaData,
total: _wcfSchemaTotal
},
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."); }
};
//var EndlessScrollDataSource = kendo.data.DataSource.extend({
// _observe: function (data) {
// if (this._page > 1) {
// this._data.push.apply(this._data, data);
// return this._data;
// }
// return kendo.data.DataSource.prototype._observe.call(this, data);
// }
//});
return {
clear: function (dataSource) {
dataSource.view().splice(0, dataSource.view().length);
},
expositionsList: new kendo.data.DataSource(new DataSourceConfig(config.expositionUrl + "?lang=pl-PL", "Name",null,'json')),
};
});