Topic: Datepicker how to clear/reset via code?

BigMonkey pro asked 10 months ago


How do you reset the Datepicker back to default state? If I set a date and then want to clear it via code I can set the value which clears the date field but if I then re-open the picker it still has the previous date highlighted.

I tried calling handleClear() which throws an exception and clearButton is null so can't trigger a click.


Dawid Wajszczuk staff answered 10 months ago


Hi,

You can try to reset the form, then dispose the datepicker and re-initialize it. Here is the snippet https://mdbootstrap.com/snippets/standard/d-wajszczuk/3590051.

Keep coding,
Dawid



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

  • User: Pro
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 3.10.0
  • Device: Desktop
  • Browser: FF
  • OS: Win 7
  • Provided sample code: No
  • Provided link: No