Click for tab bar in EXTJS

i use the tab bar in extjs. I want to display a warning when I click on a tab. But I'm not sure how to do this.

This is what I am doing now:

{
                xtype: 'tabpanel',
                activeTab: 0,
                region: 'center',
                items: [
                    {
                        xtype: 'panel',
                        title: 'All',
                        items: [grid]

                    },
                    {
                        xtype: 'panel',
                        title: 'Closed'
                    },
                    {
                        xtype: 'panel',
                        title: 'Open'
                    }
                ],
                 listeners: {
            click: function () {
                alert('test');
            }
                         }
            }

How to display everything, close or open when this tab is clicked?

+5
source share
2 answers

There is no event to go to the tab in TabPanel, however, you can bind to the click event on each tab:

Ext.createWidget('tabpanel', {
    items: [...],
    listeners: {
        render: function() {
            this.items.each(function(i){
                i.tab.on('click', function(){
                    alert(i.title);
                });
            });
        }
    }
});

Please note: this is ExtJS 4 based code.

+14
source

, tabchange. newCard.xtype, xtype (.. task-archive) - xtype.

Ext.define('ComplexBrigade.controller.taskArchive.TaskArchive', {
    extend: 'Ext.app.Controller',

    init: function() {
        this.control({
            '#tabWorks': {
                tabchange: this.doTest
            }
        });
    },

    doTest: function ( tabPanel, newCard, oldCard, eOpts) {
        switch (newCard.xtype) {
            case "task-archive":
                console.log("task-archive");
                break;
            case "task-creation":
                console.log("task-creation");
                break;
        }
    }
});
0

All Articles