需求
在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
}
}
]
本文介绍如何在Ext.form.Panel中添加一个可点击的标签,并通过示例代码展示了如何为其注册click事件,当点击该标签时,将显示一个窗口。

320

被折叠的 条评论
为什么被折叠?



