首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >EXTJS 6.7 -标签字段-什么是字段选定项目mouseover、mouseout、selected (不是下拉式项目!)

EXTJS 6.7 -标签字段-什么是字段选定项目mouseover、mouseout、selected (不是下拉式项目!)
EN

Stack Overflow用户
提问于 2020-07-06 16:58:54
回答 1查看 75关注 0票数 0

我需要一些帮助来解决我的问题。我有标签字段与选定的项目。我想知道如何为mouseover、mouseout、selected on items in field,而不是items in dropdown list附加事件)

这只是一个用于测试的标签字段的示例。

代码语言:javascript
复制
Ext.application({
name : 'Fiddle',

launch : function() {
    //Ext.Msg.alert('Fiddle', 'Welcome to Sencha Fiddle!');
    
   var shows = Ext.create('Ext.data.Store', {
    fields: ['id','show'],
    data: [
        {id: 0, show: 'Battlestar Galactica'},
        {id: 1, show: 'Doctor Who'},
        {id: 2, show: 'Farscape'},
        {id: 3, show: 'Firefly'},
        {id: 4, show: 'Star Trek'},
        {id: 5, show: 'Star Wars: Christmas Special'}
    ]
    });
    
    let lbl = Ext.create('Ext.form.Label', {
        text: 'select item'
    });
    
    let win = Ext.create('Ext.window.Window', {
        width:800,
        height: 700,
        modal: true,
        items: [
          
           {
                xtype: 'tagfield',
                fieldLabel: 'Select a Show',
                store: shows,
                displayField: 'show',
                valueField: 'id',
                queryMode: 'local',
                filterPickList: true,
                listConfig: {
                    listeners: {
                        //events for dropdownlist 
                        highlightitem: function() {
                            lbl.setText('highlighted');
                        }
                        
                    }
                }
            },
            lbl
      ]    
    });
    win.show();
    }
});

问候

阿曼多

EN

回答 1

Stack Overflow用户

发布于 2020-07-06 20:22:32

您可以在itemList上设置监听器

代码语言:javascript
复制
                        afterrender: function () {
                            this.itemList.on({
                                mouseover: {
                                    fn: function () {
                                        alert('mouseover on tag')
                                    },
                                    delegate: 'li.x-tagfield-item',

                                },
                                
                                  mouseout: {
                                    fn: function () {
                                        alert('mouseout on tag')
                                    },
                                    delegate: 'li.x-tagfield-item',

                                }
                            });
                        }

fiddle

附言:谢谢你的小提琴例子)

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62752568

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档