1. #1
    Ext User olivierGimenez's Avatar
    Join Date
    Jun 2007
    Location
    Paris
    Posts
    7
    Vote Rating
    0
    olivierGimenez is on a distinguished road

      0  

    Exclamation How to stop (cancel) 'deactivate' event on a TabPanelItem ?

    How to stop (cancel) 'deactivate' event on a TabPanelItem ?


    Hi guys !

    I need to stop the propagation of the events if a condition is not satisfied when a tabPanelItem is deactivated.
    I use this code :
    PHP Code:
    tab.on('deactivate', function(tabPaneltabPanelItem) {
    if (!
    wizard2view.saveCurrentPropertiesGroup(tabPanelItem.idnull)) {
      
    // Cancel the event propagation
    }
    }); 
    But, as I read it in the documentation, the event is not given as parameter to the function that handles the "deactivate" action. So I can not code something like that
    PHP Code:
    e.cancel true
    So, how can I do ?? I'm really lost ...

    Thanx.

  2. #2
    Ext User olivierGimenez's Avatar
    Join Date
    Jun 2007
    Location
    Paris
    Posts
    7
    Vote Rating
    0
    olivierGimenez is on a distinguished road

      0  

    Default


    I've tryed that but it was not a success :
    PHP Code:
                                        tab.on('deactivate', function(tabPaneltabPanelItem) {
                                            if (!
    wizard2view.saveCurrentPropertiesGroup(tabPanelItem.idnull)) {
                                                return 
    false;
                                            }
                                        }); 

  3. #3
    Ext User olivierGimenez's Avatar
    Join Date
    Jun 2007
    Location
    Paris
    Posts
    7
    Vote Rating
    0
    olivierGimenez is on a distinguished road

      0  

    Default


    I've found a solution. Instead of catching the 'deactivate' event on the tabPanelItem, I've coded that :
    PHP Code:
                    wizard2view.jtabs.on('beforetabchange', function (tabPaneletabPanelItem) {
                        if (
    tabPanel.getActiveTab() && tabPanel.getActiveTab().id != 'treeContentPanel') {
                            if (!
    wizard2view.saveCurrentPropertiesGroup(tabPanel.getActiveTab().idnull)) {
                                
    e.cancel true;
                            }                    
                        }
                    }); 
    where wizard2view.jtabs is a TabPanel.

    The model event is strange on this point, i guess.

    Thanx guys.