Topic: trigger date picker on button click

herve pro asked 5 years ago


Hello, Before Angular version i could trigger the datepicker popup by clicking on a button. with the angular version I have not found a way to do it, is it possible? moreover, some options do not seem to work well, for example when I use a label, it appears over the chosen date and it does not have the same behavior as with a normal input field here is the code i use :
<mdb-date-picker [options]="myDatePickerOptions" [(ngModel)]="model" [label]="'la date'"></mdb-date-picker>
I use the version 6.2.6 thank you

Damian Gemza staff answered 5 years ago


Dear 4ntibala,

With the next release of MDB Angular there will be added features like:

1) events for clear, close, today buttons,

2) option to have a minimalistic version

Best Regards,

Damian


4ntibala pro answered 5 years ago


thanks - this is really good to hear!
btw, as you are on it right now.. may i suggest features like:

- close picker after date was clicked (selected) OR

- events for Clear, Close & Today buttons

- show/hide picker functions

- option to have a minimalistic version, like so example


Arkadiusz Idzikowski staff commented 5 years ago

Closing date picker after click is already possible. You need to add 'clearAfterSelect: true' property to the date picker options object. I added the other features to our nice-to-have list, thank you for the suggestions.


Arkadiusz Idzikowski staff answered 5 years ago


Dear 4ntibala,

It will be fixed in new version (this week), thank you for letting us know about this problem.

Regards,

Arek


4ntibala pro answered 5 years ago


this does not seem to work anymore... since i updated to version 7.1.0 ?! will u provide an alternative to trigger the date selection on button click? 


Arkadiusz Idzikowski staff answered 5 years ago


You can find date picker documentation here: Date Picker This page will be updated in near future.

herve pro answered 5 years ago


Good morning, after picking a date, is it possible to affect the date to another field ? where can i find all the method available with the date picker component ? thank you

Arkadiusz Idzikowski staff answered 5 years ago


Dear herve, Thank you for the confirmation. You can add template variable (for example #date-picker) to mdb-date-picker and then in your ts file use @ViewChild decorator to get access to date picker methods.
@ViewChild('date-picker') datePicker: MDBDatePickerComponent;
Then on the button click you can call following method:
this.datePicker.openBtnClicked();
We will take a closer look at the problem with label. Could you specify what are the problems with other options?
Regards,
Arek

Arkadiusz Idzikowski staff answered 5 years ago


Dear herve, Date picker is a premium component, and according to our system, you use MDB Free version. Please, provide us a number of your order or registered email to confirm your access to MDB Pro components and premium support. You can send it to me on email: a.idzikowski@mdbootstrap.com Regards, Arek

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 6.2.3
  • Device: pc
  • Browser: chrome
  • OS: windows 7 64bits
  • Provided sample code: No
  • Provided link: No