SelectedIndexChanged only when is an UI action

Posted by: bogdan.neagu on 16 May 2018, 8:09 am EST

  • Posted 16 May 2018, 8:09 am EST

    Hello,

    I have a bit of a problem determining whether combo-box’s selectedIndexChanged was triggered by an UI action. I was using something like

    
    someDropdownChanged(someCombo: wjInput.WjComboBox) {
            if (someCombo.isDroppedDown) {
    // do stuff
    }
    }
    
    

    But since I upgraded to the latest version, the “isDroppedDown” property is false even if the user changed the selection. I’ve tried to deal with this by keeping an old element(index) in a variable but I wish to know if there was any better way. Or maybe this change of behaviour of wijmo is a bug on your side.

    Thanks.

  • Posted 17 May 2018, 4:08 am EST

    Hi,

    You may accomplish your requirement using given below steps:

    Handle isDroppedDownChanged event and flag a variable.

    Check if flag is true in selectedIndexChanged event.

    ~Manish

  • Posted 22 May 2018, 4:12 am EST

    Hello,

    Yeah, that’s what I used but it feels hackish. It was cleaner to just test for the isDroppedDown property. Is this intended behaviour or it’s a bug on your side? It feels wrong because the events are like this when dropping down and selecting an item:

    isDroppedDownChanged → true

    selectedIndexChanged → isDroppedDown == false (!!)

    isDroppedDownChanged → false

    It feels wrong that even though the selectedIndexChanged event is called before the isDroppedDownChanged(false), the property isDroppedDown is false…

    Thanks.

  • Posted 23 May 2018, 4:52 am EST

    Hi,

    The behavior observed is by design.

    Please refer to the following sample for accomplishing your requirement.

    https://stackblitz.com/edit/angular-vkcqs8?file=app/app.component.html

    ~Manish

  • Posted 24 May 2018, 10:33 am EST

    OK, thanks.

    I want to report a bug, when you use currentItem like this:

    new wjcCore.CollectionView(d, {currentItem: d[2]});
    

    The elements in the combo-box are messed up: the first element is exactly as the 3rd one.

    Even the initial collection (d) is changed (as you can see in the console.log)

    Please find the example here: https://angular-7rcyus.stackblitz.io

    Bogdan.

  • Posted 25 May 2018, 7:31 am EST

    Hi,

    We are sorry for the inconvenience.

    We are able to replicate the issue at our end. It seems a bug. Hence, this issue has been forwarded to the concerned team for further investigation with tracking id 324003.

    In the meantime, you may set currentItem as following code snippet:

    cv.currentItem=d[2]
    /*  or  */
    cv.moveCurrentToPosition(2)
    

    ~Manish

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels