Ng2-select: Hide the list of select when two select in the same page

Created on 22 Sep 2016  ·  4Comments  ·  Source: valor-software/ng2-select

Hello !
I have two ng2-select in the same page. When i click on the first without choosing a item on the list and after i click on the second select, the two select are open.
So, I would like to hide the list of the first select when i click on the second ng2-select.

Somebody has a solution for this issue ?

Most helpful comment

Adding my voice to this issue as I'm seeing the same as well. 😄

In my situation, I have two selects near each other and when one is selected and then the one above it is clicked without selecting an item from the first one opened, the two selects will interfere with each other. One will be visually on top of the other.

Things I've tried

I tried working with the offClick directive and event but that _will not_ fire when clicking from one ng-select to another. It's not seen as an "off click" event since you're clicking on another ng select element.

Somehow the events need to be specific to a select element so that when you click on a different select, it's seen as an "off click" event for the first one. Or, upon opening a select, ensure all others are closed first?

Screenshots

Clicking the first one

screenshot 2016-11-11 11 39 46

Clicking the second one

The result is that the two are open at the same time and the one overlaps the other.

screenshot 2016-11-11 11 39 53

All 4 comments

I have a similar issue, I would like to hide the list when clicking anywhere in the page that is not the list or the input for the select. Any ideas??

Adding my voice to this issue as I'm seeing the same as well. 😄

In my situation, I have two selects near each other and when one is selected and then the one above it is clicked without selecting an item from the first one opened, the two selects will interfere with each other. One will be visually on top of the other.

Things I've tried

I tried working with the offClick directive and event but that _will not_ fire when clicking from one ng-select to another. It's not seen as an "off click" event since you're clicking on another ng select element.

Somehow the events need to be specific to a select element so that when you click on a different select, it's seen as an "off click" event for the first one. Or, upon opening a select, ensure all others are closed first?

Screenshots

Clicking the first one

screenshot 2016-11-11 11 39 46

Clicking the second one

The result is that the two are open at the same time and the one overlaps the other.

screenshot 2016-11-11 11 39 53

@toke182 seems like fixed with 43b4c1074fb4700e20b24b35f12ba4c1619b152c

@grantlucas Thanks, we will check

@SergeyKuryatnick Thanks! Greatly appreciated. 😄

Was this page helpful?
0 / 5 - 0 ratings

Related issues

carstenschaefer picture carstenschaefer  ·  5Comments

BenDevelopment picture BenDevelopment  ·  5Comments

denghuiquan picture denghuiquan  ·  3Comments

Cadenei picture Cadenei  ·  4Comments

bissolli picture bissolli  ·  6Comments