Search code examples
dojodijit.layout

djit.layout.Tabcontainer - click-based event is fired two times


I want to add listeners on selection event, but implementation via code below fired event two times. Only javascript core onClick event is fired correctly one time.

dojo.connect(myTabCont, "onButtonClicked", function(tabList){
    console.log(tablist);
});
dojo.connect(myTabCont, "selectChild", function(tabList){
    console.log(tablist);
});

//work fine - one click one fire
dojo.connect(myTabCont, "onClick", function(event){
    console.log(event);
});

Is there is feature or bug? Or can you help how to workaround these funcionality or way how to broke this feature || bug.

Thanks


Solution

  • You could monitor the [widgetId]-selectChild topic, which will only fire once, or just ignore myTC.selectChild(foo) calls when foo == myTC.selectedChildWidget.

    Equals check between old-selection and new-selection in Stack_Container.selectChild method is ok!

    There is no bug. Registered "selectChild" is called two times and this is correct behaviour. First calling of "selectChild" is event fired by user, the second calling is programmaticlly when StackContainer check if old-selection NOT equals new-selection and fire onclick on tabItem explicitly.