-
Notifications
You must be signed in to change notification settings - Fork 12
BootstrapDatepicker
André Camilo edited this page Jan 5, 2015
·
2 revisions
This component creates a date picker for an input field (it needs to be a DateTextField
). It supports internationalization out of the box, the locale included on the page is the Wicket session locale.
The javascript library we used for this component is: https://github.com/eternicode/bootstrap-datepicker
In this example we create a datepicker initialized with today's date.
The html code:
<div class="date" data-date-autoclose="true"
data-date-clear-btn="true" wicket:id="inputDate">
<span class="add-on"></span>
<input wicket:id="inputTextField" type="text"/>
</div>
The java code:
BootstrapDatepicker input = new BootstrapDatepicker("inputDate");
input.add(new DateTextField("inputTextField", Model.of(DateTime.now())));
add(input)
Read the date in the model:
input.getModel().getObject()
- Add a clear button
data-date-clear-btn="true"
- See the bootstrap datepicker documentation for other options:
http://bootstrap-datepicker.readthedocs.org/en/release/options.html