valor-software / ngx-bootstrap

Fast and reliable Bootstrap widgets in Angular (supports Ivy engine)
https://valor-software.com/ngx-bootstrap
MIT License
5.53k stars 1.69k forks source link

Dropdown close after date select #5357

Closed dl7 closed 5 years ago

dl7 commented 5 years ago

Bug description or feature request:

I'm creating a component to filter data in a table. The component is using dropdown. In dropdownMenu I can put various types of input e.g. checkboxes, text, datepicker. Checkboxes and text work very well, but I've problem with datepicker. When I select a date, both datepicker and dropdown close, but I want to dropdown stay open.

It is possible to add [autoClose]="false" property, however I would like to keep the auto close behavior after outside click.

GIF

There is any solution to prevent dropdown close after date select?

Plunker/StackBlitz that reproduces the issue:

StackBlitz: https://stackblitz.com/edit/angular-nusk6m

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap: 5.1.2

Angular: 8.2.0

Bootstrap: 4.3.1

ludmilanesvitiy commented 5 years ago

@dl7 You can set [autoClose]="false" to the dropdown, like in this example: https://valor-software.com/ngx-bootstrap/#/dropdowns#autoclose

dl7 commented 5 years ago

@ludmilanesvitiy However, as I mentioned, I would like to keep the auto close behavior after outside click. If I set [autoClose]="false", it won't work.

faresk93 commented 4 years ago

I have the same problem. Any solution ?

sujeetjaiswara commented 4 years ago

Same problem. Any solution ?

PieterjanDeClippel commented 3 years ago

Same here

nikolastj commented 3 years ago

Actually I found the solution that worked for me: bs-datepicker-inline and implement custom dropdown element on ng-select

anuragxcode commented 2 months ago

i was facing the same issue, i fixed through adding class to my ngbDropdown and the button which click i reopen the dropdown.

@HostListener('document:click', ['$event']) onClick(event: MouseEvent) { if (this.dateFilterButton.nativeElement.contains(event.target) || this.dateFilterSpan.nativeElement.contains(event.target)) { this.dropDown.open(); } else if (this.dropDown && !this.ddEl.nativeElement.contains(event.target) && this.dropDown.isOpen() && !document.querySelector(".cdk-overlay-backdrop")) { this.close(); } }

also need to find the appended call while you open the datepicker. Ex : !document.querySelector(".cdk-overlay-backdrop")