CKEditor我如何执行兄弟元素的OnChange



我有一个带有按钮和输入的自定义对话框。在按钮的单击事件上,我想触发输入的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();
        }
    }
    ]
}

最新更新