我使用来自https://code.google.com/p/extjs4dwr的dwrproxy.js并创建了一个带有商店的网格
Ext.onReady(function() {
Ext.define('Record', {
extend: 'Ext.data.Model',
fields : [
{name: 'clientName'},
{name: 'type'}
],
proxy : {
type: 'dwr',
dwrFunction : Manager.getList,
reader : {
type: 'json',
root: 'data',
totalProperty: 'count'
}
}
})
var store = Ext.create('Ext.data.Store', {
requires : ['Ext.ux.DwrProxy'],
model: 'Record'
});
var grid = new Ext.grid.GridPanel({
store : store,
columns: [
{header: "clientName", width: 260, sortable: true, dataIndex: 'clientName'},
{header: "type", width: 260, sortable: true, dataIndex: 'type'}
],
title:'Test view',
renderTo: 'container'
});
store.load();
});
Manager.getList
看起来
Manager.getList = function(p0, p1, callback) {
dwr.engine._execute(Manager._path, 'Manager', 'getList', p0, p1, callback);
}
我在 dwr 中接收数据
throw 'allowScriptTagRemoting is false.';
//#DWR-INSERT
//#DWR-REPLY
var s0=[];var s2={};var s3={};
s2.clientName='Client1';s2.type='Type1';
s3.clientName='Client2';s3.type='Type2';
s1.descendingOrder=true;s1.pageNo=null;s1.pageSize=1;s1.sortField="lastEditTime";
dwr.engine._remoteHandleCallback('1','0',{data:s0,dataSize:2,fromIndex:0,fromIndexDisp:1,gridState:s1,metaData:null,moreData:null,pageNo:0,pageNumber:1});
一切看起来都很好,但网格仍然处于“加载”状态并且没有视图。请帮忙。