Dojo.gridx Dojo Gridx1.9和JsonRest以及WCF REST服务
我正在尝试使用WCFRestService学习Dojo的GridX。我得到“没有要显示的项目” WCF接口设置为WebMessageFormat.JSON:Dojo.gridx Dojo Gridx1.9和JsonRest以及WCF REST服务,dojo.gridx,Dojo.gridx,我正在尝试使用WCFRestService学习Dojo的GridX。我得到“没有要显示的项目” WCF接口设置为WebMessageFormat.JSON: [OperationContract] [WebGet (ResponseFormat=WebMessageFormat.Json)] List<Account> GetAccountList(); 我检查了Fiddler和响应标题: 内容长度:2790 内容类型:text/html 任何帮助都将不胜感激 将这些添加到要求部分
[OperationContract]
[WebGet (ResponseFormat=WebMessageFormat.Json)]
List<Account> GetAccountList();
我检查了Fiddler和响应标题:
内容长度:2790
内容类型:text/html
任何帮助都将不胜感激 将这些添加到要求部分:
'dojo/store/Cache',
'gridx/core/model/cache/Async',
'dojo/store/Observable',
'dojo/store/JsonRest',
'dojo/data/ObjectStore',
'dojo/store/Memory',
使用以下内容添加/编辑网格函数:
var requestString = "http://server/web/Service1.svc/GetAccount";
var store = new Cache(new JsonRest({target:requestString, idProperty: "id"}), Memory());
var objectStore = ObjectStore({objectStore: store});
window.grid = new Grid({
store: objectStore,
cacheClass: Async,
autoHeight: true,
structure: layout,
modules: [SingleSort]
});
调用下面的网格:
grid.placeAt('gridContainer');
grid.startup();
为了使gridx控件能够与JSONRest一起工作,您需要在响应中返回如下内容范围:items 0-24/66 有关详细信息,请参阅本页
我这样试过。。但是我甚至没有得到列标题,也没有得到错误“No items to display”。现在它只是一个空白页,在var store=new Cache处出现错误。。。。。有什么想法吗?我以为你只需要在使用分页时设置它?谢谢,我添加了内容范围,并确保模块以与数组完全相同的顺序传递,然后一切正常!!
grid.placeAt('gridContainer');
grid.startup();