CKEditor如何执行兄弟UIElement的OnChange

时间:2011-12-01 18:45:00

标签: dialog ckeditor onchange uielement

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

1 个答案:

答案 0 :(得分:1)

我发现(另一位开发者向我展示),然后回答:

{
    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();
        }
    }
    ]
}