我有一个带有按钮和输入的自定义对话框。在按钮的单击事件上,我想触发输入的OnChange
函数。我不知道如何得到当前的兄弟UIElement
。
{
id : 'txtUrl',
type : 'text',
label : 'My input',
onChange : function() {
alert('content changed')
}
}
{
type : 'button',
align : 'center',
label : 'My Button',
onClick : function() {
// execute the input.onChange()
?????
}
}
我刚刚发现(另一个开发人员向我展示),这里是答案:
{
id : 'info',
label : 'my container',
elements :
[
{
id : 'txtUrl',
type : 'text',
label : 'My input',
onChange : function() {
alert('content changed')
}
}
{
type : 'button',
align : 'center',
label : 'My Button',
onClick : function() {
this.getDialog().getContentElement("info", "txtUrl").onChange();
}
}
]
}