Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to show a message just before datepicker shown? #6500

Open
adurmus opened this issue Sep 2, 2022 · 1 comment
Open

Is there a way to show a message just before datepicker shown? #6500

adurmus opened this issue Sep 2, 2022 · 1 comment

Comments

@adurmus
Copy link

adurmus commented Sep 2, 2022

I'd like to display a message to user when input field is clicked (toaster message) and when the user sees and closes the message then open the datepicker. beforeShown event?

Is this achievable with existing events?

@adurmus
Copy link
Author

adurmus commented Sep 2, 2022

Figured out a hack

.html

<input type="text" #datePicker="bsDatepicker" [triggers]="''" placeholder="Datepicker" class="form-control" (mouseup)="onShownDatePicker($event)" bsDatepicker>

.component.ts

@ViewChild('datePicker') datePicker: BsDatepickerDirective;

onShownDatePicker(): void {
	//show your message here and in the event of closing your message fire to display datepicker. 
      this.messageService.showInfo(
        'your message before displaying date picker',
        'Important',
        { didClose: () => this.datePicker.show() }
      );
  }

You must set the triggers input to ''. Otherwise it will display the date picker.
you call (mouseup) event to show the message. onShown won't be fired as triggers is set to ''.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant