1

在我toolbar那里checkbox用于启用和禁用tooltip. 如果checkbox选中了,那么我应该启用tooltip它并且它正在工作,如果没有,那么我应该禁用它也可以工作。禁用后tooltip,当单击toolbar未单击任何项​​目时,toolbar它也处于启用状态。

toogleTooltiphandler一个checkbox

function toggleTooltip() {
    debugger;
    if (Ext.getCmp("msai_tool_tip").checked) {
        Ext.QuickTips.enable();
        while (!Ext.QuickTips.isEnabled())
            Ext.QuickTips.enable();
    } else {
        Ext.QuickTips.disable();
        while (Ext.QuickTips.isEnabled())
            Ext.QuickTips.disable();
    }
}

这是我的工具栏创建代码:

Ext.QuickTips.init();
var tb = new Ext.Toolbar({
    id: 'form_menu_bar',
    renderTo: Ext.get('newproducttitle').dom,
    items: [{
        tooltip: {
            text: "Click on this button to generate the template and save it in server.",
            title: "Save",
            xtype: "quicktip"
        },
        iconCls: 'msai_save_template',
        handler: generateTemplate

    }, {
        tooltip: {
            text: "Click on this button to generate the template.",
            title: "Save to clipboard",
            xtype: "quicktip"
        },
        iconCls: 'msai_save_clipboard',
        handler: generateTemplateClipboard
    }]
});

tooltip如果用户单击工具栏而不是任何项目,请提出一些解决方案,以便我不显示。

4

1 回答 1

0

请找到下面的小提琴来检查工作示例: https ://fiddle.sencha.com/#view/editor&fiddle/2c7k

代码片段:

Ext.QuickTips.init();

var tb = new Ext.Toolbar({
        renderTo: document.body,
        width: 600,
        height: 100,
        items: [{
            // xtype: 'button', // default for Toolbars, same as 'tbbutton'
            text: 'Button',
            tooltip: 'button'
        }, {
            xtype: 'splitbutton', // same as 'tbsplitbutton'
            text: 'Split Button',
            tooltip: 'Split Button'
        }, {
            xtype: 'checkbox',
            boxLabel: 'enable tooltip',
            checked: true,
            listeners: {
                check: function (checkbox, newValue, oldValue) {
                    if (newValue) {
                        Ext.QuickTips.enable();
                    } else {
                        Ext.QuickTips.disable();
                    }
                }
            }
        }]
    });
于 2018-01-23T08:40:44.413 回答