views:

77

answers:

2

Hi,

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

A: 

Sounds like a bug. selectChild() is idempotent so there's no harm in calling it twice (except for people like you that are connecting to it :-) ), so that's why we didn't notice the problem.

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

Bill Keese
I am going to monitor this state, but I think this is not a big problem until you build UI where all changes of content in widgets are managed via ajax requests. By the way - dojo framework is powerfull toolkit, great job.
derhaa
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.
derhaa
A: 

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.

derhaa