2010-09-21 20 views

Répondre

2

J'ai le même problème, il n'y a aucun moyen direct de le faire, mais vous pouvez prolonger votre widget:


dojo.extend(dijit.layout.TabController, { 
    onButtonClick: function(/*dijit._Widget*/ page,evt) { 
     // summary: 
     //  Called whenever one of my child buttons is pressed in an attempt to select a page 
     // tags: 
     //  private 
     this.beforeButtonClick(page,evt); 
     this._onButtonClick(page,evt); 

    }, 
    beforeButtonClick:function(page,evt){ 

    }, 
    _onButtonClick:function(page,evt){ 
     console.log(evt.cancelBubble); 
     if(evt.cancelBubble){ 
      return; 
     } 
     var container = dijit.byId(this.containerId); 
     container.selectChild(page); 
    } 
}); 

l'utilisation est:


var widget = dijit.byId('your_tabContainer'); 
dojo.connect(widget.tablist,"beforeButtonClick",function(page,evt){ 
//do the detection, if it meet the condition, ignore it, 
//if not, stop the event 
    if(page.id !== "tab1"){ 
     dojo.stopEvent(evt) 
    } 
}); 
+0

fonctionne très bien! Merci – danielpradilla