我正在尝试使用 WCF RESTservice 学习 Dojo 的 GridX。我收到“没有要显示的项目”
WCF 接口设置为 WebMessageFormat.JSON:
[OperationContract]
[WebGet (ResponseFormat=WebMessageFormat.Json)]
List<Account> GetAccountList();
在网络配置中,我已将端点行为设置为使用“webHttpBinding”
这是脚本:
require([
'dojo/store/JsonRest',
'gridx/Grid',
'gridx/core/model/cache/Async',
'dojo/domReady!'
], function (Store, Grid, Cache) {
var jsonStore = new Store({
target: "http://server/web/Service1.svc/GetAccount"
});
//test - this is working, I am seeing the data
//jsonStore.query({}, { start: 0 }).then(function (items) {
// alert(items[0].AccountName);
//});
var columns = [
{ field: 'AccountId', name: 'AccountId' },
{ field: 'AccountName', name: 'AccountName' },
{ field: 'AccountNumber', name: 'AccountNumber' }
];
var grid = new Grid({
store: jsonStore,
cacheClass: Cache,
autoHeight: true,
structure: columns
});
grid.placeAt("gridNode");
grid.startup();
});
我检查了 Fiddler 和响应标头: Content-Length: 2790 Content-Type: text/html
任何帮助将不胜感激!