论坛首页 Web前端技术论坛

我的ext范例

浏览 24277 次
锁定老帖子 主题:我的ext范例
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2007-12-17  
to:
thomasg:抱歉!我未在ie下测试。
to:
laiseeme:我用eclipse3.2 +jetty 指定context为web context就可以
http://jettylauncher.sourceforge.net/updates/
to:rain16881
关键是record定义var IncomeDaily = Ext.data.Record.create(...
]);
var ds = new Ext.data.Store({
proxy: new Ext.data.DWRProxy(houseChargeService.findIncomeDaily),
reader: new Ext.data.JsonReader({totalProperty:'total',root:'list',id:'id'},IncomeDaily),
remoteSort: false,
});
指定jsonReader为reader, 返回查询总数在total栏位 明细数据在list
你可以显示出来看一看或用firebug返回数据与record定义是否一致。
dwrproxy中加入alert
loadResponse : function(listRange, reader, callback, scope, arg) {
var result;
try {
result = reader.readRecords(listRange);
            alert(result.total);//显示出来看一看
} catch(e) {
this.fireEvent("loadexception", this, null,listRange, e);
callback.call(scope, null, arg, false);
return;
}
callback.call(scope, result, arg, true);
}
0 请登录后投票
   发表时间:2007-12-19  
//#DWR-INSERT

//#DWR-REPLY

var s0=[];var s1={};var s3={};var s2={};var s4={};s0[0]=s1;s0[1]=s2;

s1.classInfo="fds";s1.className="05ACCP3";s1.id="402881f016528bf30116528c93f90002";s1.userCollege=s3

;

s3.collegeInfo="\u6539\u4E0B\u4E5F";s3.collegeName="\u8BA1\u7B97\u673A\u5DE5\u7A0B\u5B66\u9662";s3.id

="402881f01652384d0116523abe250003";

s2.classInfo="fsd";s2.className="fds";s2.id="402881f016c6d7070116c702e4640002";s2.userCollege=s4;

s4.collegeInfo="\u5916\u56FD\u5B66\u9662";s4.collegeName="\u5916\u56FD\u8BED\u5B66\u9662";s4.id="402881f0167b0c7501167b45d3de000a"

;

dwr.engine._remoteHandleCallback('0','0',{list:s0,total:2});
这个是fbug中的请求返回的数据

var Userclass = Ext.data.Record.create([
{name: "id", mapping: "id", type: "string"},
{name: "className", mapping: "className", type: "string"},
{name: "classInfo", mapping: "classInfo", type: "string"},
{name: "userCollege_id", mapping: "userCollege.id", type: "string"},
{name: "userCollege_collegeName", mapping: "userCollege.collegeName", type: "string"},
{name: "userCollege_collegeInfo", mapping: "userCollege.collegeInfo", type: "string"},
]);
var ds = new Ext.data.Store({
       proxy : new Ext.data.DWRProxy(classAction.findAllClass_Ajax), 
reader:  new Ext.data.JsonReader({totalProperty:'total',root:'list',id:'id'},Userclass),
remoteSort: false,
    });
var colModel  = new Ext.grid.ColumnModel(
[
new Ext.grid.RowNumberer(),
{header: "班级序号", width: 250, sortable: true, dataIndex: 'id'},
{header: "班级名字", width: 250, sortable: true, dataIndex: 'className'},
{header: "班级信息", width: 250, sortable: true, dataIndex: 'classInfo'},
{header: "学院序号", width: 250, sortable: true, dataIndex: 'userCollege_id'},
{header: "学院名字", width: 250, sortable: true, dataIndex: 'userCollege_collegeName'},
{header: "学院信息", width: 250, sortable: true, dataIndex: 'userCollege_collegeInfo'},
]
);
colModel.defaultSortable=true;

var ClassManageEditorGridPanel = new Ext.grid.EditorGridPanel({
                        store: ds,
                        cm: colModel,
                        //selModel: new Ext.grid.RowSelectionModel(),
                        sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
                        loadMask :true,
                        autoSizeColumns: true,
                        enableColLock:false,
buttonAlign:'top', 
tbar:
[{ 

        text: '新增', 
        handler :doAdd 
    },{ 
        text: '删除', 
        handler : doDel 
    },collegesortComboBox
    ] 
                    });

if(!win){
            win = desktop.createWindow({
                id: 'grid-win-classmanage',
                title:'班级管理',
                width:740,
                height:480,
                iconCls: 'icon-grid',
                shim:false,
                animCollapse:false,
                constrainHeader:true,

                layout: 'fit',
                items:
                    ClassManageEditorGridPanel
            });
        }
        ds.load();
        win.show();

请问..为什么数据可以得到了..但是还不能在grid中有数据..
grid一直都是Loading.....

是reader的问题吗?
谢谢了..请指教
0 请登录后投票
   发表时间:2007-12-19  
Ext.data.DWRProxy = function(dwrCall,dwrParams){
Ext.data.DWRProxy.superclass.constructor.call(this);
this.dwrCall = dwrCall;
this.dwrParams=dwrParams||[];
};

Ext.extend(Ext.data.DWRProxy, Ext.data.DataProxy, {
load : function(params, reader, callback, scope, arg) {
    var self = this;
if(this.fireEvent("beforeload", this, params) !== false) {
var delegate = this.loadResponse.createDelegate(this, [reader, callback, scope, arg], 1);
arg.params=arg.params||{};
var allParams=[arg.params.start||0,arg.params.limit||2].concat(this.dwrParams);
allParams.push(delegate);
this.dwrCall.apply(this,allParams);
} else {
callback.call(scope || this, null, arg, false);
}
},

loadResponse : function(listRange, reader, callback, scope, arg) {
var result;
try {
result = reader.readRecords(listRange);
alert(result.total);//显示出来看一看 } catch(e) {
this.fireEvent("loadexception", this, null,listRange, e);
callback.call(scope, null, arg, false);
return;
}
callback.call(scope, result, arg, true);
}

});

加粗的地方也没有反应..一直是Loading..
0 请登录后投票
   发表时间:2008-03-26  
请问楼主,我把程序放在jb2006里面运行,发现少了很多包
能不能把你得饱都贴上了?
0 请登录后投票
   发表时间:2008-03-27  
楼主不在????????????
0 请登录后投票
   发表时间:2008-10-24  
你真强,我也正在搞这个
0 请登录后投票
   发表时间:2008-11-04  
这也敢说是用了一段时间了,唉。
0 请登录后投票
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics