isteven / angular-multi-select

A multi select dropdown directive for AngularJS. Allows you to use HTML tags and CSS in the data. Requires only AngularJS and nothing else.
isteven.github.io/angular-multi-select
MIT License
1.08k stars 518 forks source link

How to make checkboxLayer locked to screen, so it won't close when lose focus #515

Open ghost opened 7 years ago

ghost commented 7 years ago

I attached on-select-all callback which opens modal popup with overlay. It's z-index is higher than 999, because checkboxLayer has z-index: 999, and modal must be first at the stack order. But when I click on modal container, i.e. text of modal, the checkboxLayer losts its focus and closes. Any ideas, how could I prevent this behaviour?

isteven commented 7 years ago

@aryniec ,

You'll need to modify the code, specifically on the function "externalClickListener".

IMO, the flow roughly would be like this:

  1. Most likely you need to pass an extra parameter into the directive, say the modal ID or modal class name.
  2. In that externalClickListener function, do a checking: if the click happens on that modal (by modal ID or by class name from step 1 above), then don't close the directive.
ghost commented 7 years ago

@isteven,

Isn't that function "externalClickListener" already prepared for it: https://github.com/isteven/angular-multi-select/blob/master/isteven-multi-select.js#L689

there's argument 'e' which is used in loop, and checks if any element from looped dom elements is same as this we clicked on. Shouldn't this do the job?