如何在 Ext js 中的文本框旁边显示弹出窗口

发布于 2025-01-15 05:26:53 字数 215 浏览 5 评论 0原文

当用户使用 Ext JS 单击文本框时,我想在文本框旁边显示弹出窗口(带有消息)。有人可以帮我吗?

为了版权,我删除了文字。

输入图片此处描述

I want to display popover(with message) next to textbox when user clicks on textbox using Ext JS. Can anyone please help me in this?

For copy rights I have removed the text.

enter image description here

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

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

发布评论

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

评论(1

回忆凄美了谁 2025-01-22 05:26:53

您必须向文本字段添加 focusblur 侦听器。

focus 事件中,第一个参数是文本字段。添加到窗口的文本位于 textfield.popupText 内。

例子

    xtype: 'textfield',

    popup: null,
    popupText: 'Testing Popup Text',

    listeners: {
        focus: function(field) {
            field.suspendEvent('blur');
            field.suspendEvent('focus');

            field.popup = field.popup || Ext.create({
                xtype: 'window',
                ownerCt: field,
                height: 80,
                width: 200,
                html: field.popupText
            });
            
            field.popup.showBy(field.el, 'l-r')

            field.focus();
            field.resumeEvent('blur');
            field.resumeEvent('focus')
        },
        blur: function(field) {
            field.popup.destroy();
        }

You have to add focus and blur listeners to the textfield.

Inside the focus event the first argument is the textfield. The text you add to the window is inside the textfield.popupText.

EXAMPLE

    xtype: 'textfield',

    popup: null,
    popupText: 'Testing Popup Text',

    listeners: {
        focus: function(field) {
            field.suspendEvent('blur');
            field.suspendEvent('focus');

            field.popup = field.popup || Ext.create({
                xtype: 'window',
                ownerCt: field,
                height: 80,
                width: 200,
                html: field.popupText
            });
            
            field.popup.showBy(field.el, 'l-r')

            field.focus();
            field.resumeEvent('blur');
            field.resumeEvent('focus')
        },
        blur: function(field) {
            field.popup.destroy();
        }

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