为Ext.form.Panel的xtype:label添加事件

来源:互联网 发布:企业海关数据免费查询 编辑:程序博客网 时间:2024/05/16 06:29

需求

在Ext.form.Panel中添加文字,并注册click事件。
实现如效果图所示的功能

效果图

这里写图片描述
这里写图片描述\

核心

为xtype:label添加事件

 listeners: {      render: function () {//渲染后添加click事件           Ext.select("#pipeSecrecyAgreement").on('click',               function (e, t) {                   agreementWin.show();               });       },       scope: this   }

代码

 items:[                {                    xtype:"checkbox",                    id:"optionAgreement",                    width:30,                    height:30,                    margin:"10 0 0 650",                    handler: function() {                    }                },                {                    xtype: "label",                    id:"pipeSecrecyAgreement",                    width: 150,                    height: 30,                    text: '同意管线保密协议',                    margin: " 10 0 0 0",                    border: 0,                    style: "text-decoration: underline;color:red;",                    listeners: {                        render: function () {//渲染后添加click事件                            Ext.select("#pipeSecrecyAgreement").on('click',                                function (e, t) {                                    agreementWin.show();                                });                        },                        scope: this                    }                }       ]
原创粉丝点击