kevin0796 2009-07-25 15:00
浏览 320
已采纳

有关‘this.proxy为空或不是对象’的问题

这段代码执行,在点击分页栏的 “refresh ”重新加载时 会报‘this.proxy为空或不是对象’???谢了...
Ext.namespace('tekgrid', 'tekgrid.ecoupon');
tekgrid.ecoupon.atention = function() {
var cm_res;
var rec_res, grid_res, store_res;
var form_res, win_res, panel_res;
var toolbar_res;
var atentionId, atentionTitle, atentionContent, atentionDate, atentionType, enable;
var store_atentionType, store_enable;
var form_res_e,form_res_see;

// 創建ColumnModel
function createCM() {
    cm_res = new Ext.grid.ColumnModel([{
        header : '时间'
    }, {
        header : '标题'
    }, {
        header : '公告内容'
    }, {
        header : '是否显示'
    }, {
        header : '类型'
    }]);
}

function createStore() {
    var data = [
            ['2009-7-21', '调整公告', '因业务的开展需要,本公司决定于本月低对zz进行相应的调整', 1, 1],
            ['2009-7-21', '调整公告', '因业务的开展需要,本公司决定于本月低对zz进行相应的调整', 1, 1],
            ['2009-7-21', '调整公告', '因业务的开展需要,本公司决定于本月低对zz进行相应的调整', 1, 1],
            ['2009-7-21', '调整公告', '因业务的开展需要,本公司决定于本月低对xx进行相应的调整', 1, 1],
            ['2009-7-21', '调整公告', '因业务的开展需要,本公司决定于本月低对xx进行相应的调整', 1, 1]];

    store_res = new Ext.data.SimpleStore({
        data : data,
        fields : ['TIME', 'TITLE', 'CONTENT', 'SHOW', 'ATENTIONTYPE']
    });
}

function createToolbar() {
    toolbar_res = new Ext.Toolbar([{
        text : '发布公告',
        handler : addNew
    }, {
        text : '修改',
        handler : doEdit
    }, {
        text : '删除',
        handler : function() {
            var dict = grid_res.getSelections()[0];
            if (dict != null) {
                Ext.MessageBox.confirm('删除', '是否确定要删除!', doDel)
            } else {
                Ext.MessageBox.alert('提示', '请选择一条记录');
            }
        }
    }]);
}
function createGrid() {
    createCM();
    createStore();
    createToolbar();
    createComboxStores();

    grid_res = new Ext.grid.GridPanel({
        store : store_res,
        cm : cm_res,
        height : 370,
        width : 800,
        bbar : new Ext.PagingToolbar({
            grid : grid_res,
            store : store_res,
            displayInfo : true,
            pageSize : 10
        })
    });
    panel_res = new Ext.Panel({
        height : 532,
        width : 'auto',
        frame : true,
        renderTo : 'atentionDiv',
        items : [toolbar_res, grid_res]
    });
}

function createUI() {
    createGrid();
    createForm();
}
// 创建Combox
function createComboxStores() {
    store_atentionType = new Ext.data.SimpleStore({
        fields : ['value', 'label'],
        data : [['0', '对外公告'], ['1', '对内公告']]
    });
    store_enable = new Ext.data.SimpleStore({
        fields : ['value', 'label'],
        data : [['0', '隐藏'], ['1', '显示ʾ']]
    });
}

function createForm() {
    form_res = new Ext.form.FormPanel({
        labelWidth : 115,
        frame : true,
        labelSeparator : ':',
        labelAlign : 'right',
        defaultType : 'textfield',
        items : [
        atentionId = new Ext.form.Hidden({
            name : 'ID'
        }), atentionTitle = new Ext.form.TextField({
            fieldLabel : '标题',
            width : 220,
            name : 'TITLE'
        }), atentionContent = new Ext.form.TextField({
            fieldLabel : '公告内容',
            width : 220,
            name : 'CONTENT'
        }), enable = new Ext.form.ComboBox({
            fieldLabel : '是否显示',
            width : 220,
            name : 'SHOW',
            store : store_enable,
            displayField : 'label'
        }), atentionType = new Ext.form.ComboBox({
            fieldLabel : '类型',
            width : 220,
            name : 'ATENTIONTYPE',
            store : store_atentionType,
            displayField : 'label'
        })]
    });

    form_res_e = new Ext.form.FormPanel({
        labelWidth : 115,
        frame : true,
        labelSeparator : ':',
        labelAlign : 'right',
        defaultType : 'textfield',
        items : [atentionId = new Ext.form.Hidden({
            name : 'ID'
        }), atentionTitle = new Ext.form.TextField({
            fieldLabel : '标题',
            width : 220,
            name : 'TITLE'
        }), atentionContent = new Ext.form.TextField({
            fieldLabel : '公告内容',
            width : 220,
            name : 'CONTENT'
        }), enable = new Ext.form.ComboBox({
            fieldLabel : '是否显示',
            width : 220,
            name : 'SHOW',
            store : store_enable,
            displayField : 'label'
        }), atentionType = new Ext.form.ComboBox({
            fieldLabel : '类型',
            width : 220,
            name : 'ATENTIONTYPE',
            store : store_atentionType,
            displayField : 'label'
        })]
    });
    form_res_see = new Ext.form.FormPanel({
        labelWidth : 115,
        frame : true,
        labelSeparator : ':',
        labelAlign : 'right',
        defaultType : 'textfield',
        items : [atentionId = new Ext.form.Hidden({
            name : 'ID'
        }), atentionTitle = new Ext.form.TextField({
            fieldLabel : '标题',
            width : 220,
            name : 'TITLE'
        }), atentionContent = new Ext.form.TextArea({
            fieldLabel : '公告内容',
            width : 220,
            name : 'CONTENT'
        }), enable = new Ext.form.ComboBox({
            fieldLabel : '是否显示',
            width : 220,
            name : 'SHOW',
            store : store_enable,
            displayField : 'label'
        }), atentionType = new Ext.form.ComboBox({
            fieldLabel : '类型',
            width : 220,
            name : 'ATENTIONTYPE',
            store : store_atentionType,
            displayField : 'label'
        })]
    });

}

function addNew() {
    win_res = new Ext.Window({
        width : 600,
        height : 520,
        closable : false,
        layout : 'fit',
        items : form_res,
        modal : true,
        tbar : [{
            text : '确定'
        }, {
            text : '取消',
            handler : function() {
                win_res.hide();
            }
        }]
    });

    win_res.title = '发布公告';
    win_res.show(Ext.getBody());
}

function doEdit() {
    win_res_eidt = new Ext.Window({
        width : 600,
        height : 520,
        closable : false,
        layout : 'fit',
        items : form_res_e,
        modal : true,
        tbar : [{
            text : '确定'
        }, {
            text : '取消',
            handler : function() {
                win_res_eidt.hide();
            }
        }]
    });
    var rec = grid_res.getSelections()[0];
    if (rec != null) {
        win_res_eidt.title = '编辑';
        win_res_eidt.show(Ext.getBody());
        form_res_e.getForm().loadRecord(rec);
    } else {
        alert('请选择一条记录');
    }

}

function doDel(d) {
    if (d == 'yes') {
        var r = grid_res.getSelectionModel().getSelected();
        var rec = grid_res.getSelections()[0];
        alert(rec.data.TIME);
        grid_res.getStore().remove(rec);
    }
}

return {
    init : function() {
        createUI();
    }
};

}();
Ext.onReady(tekgrid.ecoupon.atention.init, tekgrid.ecoupon.atention, true);

  • 写回答

1条回答 默认 最新

  • iteye_10013 2009-07-25 22:29
    关注

    因为你的store是SimpleStore,用的是前台数据,
    而你用的分页工具是后台分页的.

    你应该去看看PaggingStore或PagingMemoryProxy
    自带示例的example目录下有PagingMemoryProxy
    或者你去官方论坛找

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?
  • ¥15 Arcgis相交分析无法绘制一个或多个图形
  • ¥15 关于#r语言#的问题:差异分析前数据准备,报错Error in data[, sampleName1] : subscript out of bounds请问怎么解决呀以下是全部代码:
  • ¥15 seatunnel-web使用SQL组件时候后台报错,无法找到表格
  • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)