You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Functions.md 1.8 KiB

4 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. ## Functions
  2. <div class="alert alert-info">
  3. <strong>Note</strong>
  4. All functions are accessed via the <code>data</code> attribute e.g. <code>$('#datetimepicker').data("DateTimePicker").FUNCTION()</code>
  5. </div>
  6. ###destroy()
  7. Destroys the widget and removes all attached event listeners
  8. ----------------------
  9. ### toggle()
  10. Shows or hides the widget
  11. #### Emits
  12. * `dp.hide` - if the widget is hidden after the toggle call
  13. * `dp.show` - if the widget is show after the toggle call
  14. * `dp.change` - if the widget is opened for the first time and the input element is empty and `options.useCurrent != false`
  15. ----------------------
  16. ### show()
  17. Shows the widget
  18. #### Emits
  19. * `dp.show` - if the widget was hidden before that call
  20. * `dp.change` - if the widget is opened for the first time and the useCurrent is set to true or to a granularity value and the input element the component is attached to has an empty value
  21. ----------------------
  22. ### hide()
  23. Hides the widget
  24. #### Emits
  25. * `dp.hide` - if the widget was visible before that call
  26. ----------------------
  27. ### disable()
  28. Disables the input element, the component is attached to, by adding a `disabled="true"` attribute to it. If the widget was visible before that call it is hidden.
  29. #### Emits
  30. * `dp.hide` - if the widget was visible before that call
  31. ----------------------
  32. ### enable()
  33. Enables the input element, the component is attached to, by removing `disabled` attribute from it.
  34. ----------------------
  35. ### clear()
  36. Clears the datepicker by setting the value to `null`
  37. ### viewDate
  38. <small>4.14.30</small> Issue #872
  39. #### viewDate()
  40. Returns a `moment` variable with the currently set `options.viewDate` option.
  41. #### viewDate(viewDate)
  42. Takes a `string, moment or Date` value.
  43. This will change the `viewDate` without changing or setting the selected date.