3.2.0

onItemSelectedChanged fires twice when changing from one item to another. Is this a bug?

We are using ActiveWidgets 2.5 alpha2 Version.

We have a radio with four items (0,1,2,3). If we click in item 2 coming from any other item, then onItemSelectedChanged fires twice and we get the alert '2' twice. We get the same behaviour with onItemSelectedChanging

RB.onItemSelectedChanged = function()
{
alert(RB.getSelectedItems());
}

We think that if we go from 0 to 2:
RB.onItemSelectedChanging shoud fire once and RB.getSelectedItems()
value should be 0 and we should have the posibility to cancel.
RB.onItemSelectedChanged shoud fire once and RB.getSelectedItems()
value should be 2 (no posibility to cancel since already changed)

Is this the logic intended in AW? Is the behaviour we are getting a bug or are we doing something wrong?

Thanks in advance
Javier
October 17,
In _state.js we have seen that available events are
return {
onItemSelectedChanged : itemSelected,
onCurrentItemChanging : currentItem1,
onCurrentItemChanged : currentItem2,
onSelectedItemsChanging : selectedItems1,
onSelectedItemsChanged : selectedItems2
};

onCurrentItemChanging only fires once and returns the value of item you have clicked on. This works for what we need right now.

onCurrentItemChanged returns the same value.

Javier
October 17,
try a timeout, it helped me in a similar situation

RB.onItemSelectedChanged = function()
{
setTimeout(function(){
alert(RB.getSelectedItems());
}
}
Markus Schostok, Germany
October 17,
This is not a bug - onItemSelectedChanged fires for two items, for the previously selected item (from true to false) and for the new selection (from false to true).
Alex (ActiveWidgets)
October 17,

This topic is archived.

See also:


Back to support forum