-1

私は自分の extjs 4 プロジェクトに取り組んでおり、コンテナーまたは要素の上にマウスを置くと、テキスト領域が自動的に選択されて編集できるようにするメソッドを追加することを計画しています。

4

1 に答える 1

1

これを試して:

Ext.onReady(function(){
    Ext.Loader.setConfig({enabled:true});
    Ext.create('Ext.form.TextArea', {
        renderTo: 'container',
        value: '<link rel="stylesheet" type="text/css" href="resources/css/ext-all.css">\n<script type="text/javascript" src="ext-all.js"></script>',
        width: 800,
        height: 600,
        listeners: {
            render: function() {
                this.getEl().on('mouseenter', function(){
                    // 500 - is the select timeout
                    this.timeout = setTimeout(this.timeoutHandler.bind(this), 500);
                }, this);
                this.getEl().on('mouseleave', function(){
                    clearTimeout(this.timeout);
                }, this);
            }
        },
        timeoutHandler: function() {
            this.selectText();
            this.focus();
        }
    });
});
于 2011-12-17T10:40:32.020 に答える