0

HTML エディター内にテキストを入力するときに、チェック ボックスをオンにする必要があります。以下のコードは、HTML エディタ ツールバーのソース編集ボタンをクリックすると正常に動作します。すべてのボタンが無効になった後、チェックボックスがオンになります。誰でもコードを修正できますか?

extjs コードは次のとおりです。

this.mcmServiceIndicatorsOthCheckbox = new Ext.form.field.Checkbox({ fieldLabel: '', id: 'otherbox', boxLabel: 'OTH (must complete comments)' });

this.mcmServiceIndicatorsCommentsHtmlEditor = new Ext.form.HtmlEditor({
            height: 50,
            style: 'background-color: white;',
            enableSourceEdit : true,
            anchor: '100%',             
                listeners: {
                    afterrender: function(){
                      this.textareaEl.on('keyup', function() {
                         var notes = this.getValue(); 
                          if(notes.length > 0)
                          {
                              Ext.getCmp('otherbox').setValue(true);
                          }
                          else
                          {
                              Ext.getCmp('otherbox').setValue(false);
                          } 
                      });              
                    }
                }
        });
4

1 に答える 1

0

イベント用に別のイベント ハンドラーを追加するだけchangeです。

change: function () {
    Ext.getCmp('otherbox').setValue(this.getValue().length > 0);
}

作業サンプル: http://jsfiddle.net/Ld9Dj/1/

于 2013-11-07T21:13:23.267 に答える