2010-09-21 58 views

回答

2

我有同樣的問題,沒有直接的方式做到這一點,但你可以擴展你的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); 
    } 
}); 

的用法是:


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

的偉大工程!謝謝 – danielpradilla 2011-04-25 19:11:43

相關問題