如何在extjs4中通过css或java实现该方法

发布于 2024-12-22 04:21:30 字数 77 浏览 3 评论 0原文

我正在开发自己的 extjs 4 项目,我计划添加一种方法,当我们将鼠标悬停在容器或元素上时,文本区域会自动选择,然后我们可以对其进行编辑。

I am working on an extjs 4 project of my own and I am planning to add a method that, when we hover a mouse over the container or the element, the text area gets selected automatically and then we can edit it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

遗失的美好 2024-12-29 04:21:30

试试这个:

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

Try this:

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();
        }
    });
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文