Reputation: 3182
I am using the Datebox(timebox mode) jquerymobile plugin in my Rails app to choose some hours. I am trying to set the default value by using defaultPickerValue, but I dont how to add it.
I can only find this document about it http://dev.jtsage.com/jQM-DateBox1/demos/api/matrix.html#&ui-page=1-2
I have tried a lot variations like this:
<%= builder.text_field :start_time, "data-role" => "datebox", "data-options" => '{"mode": "timebox", "minuteStep": 15, "defaultPickerValue": "[12,0]" }' %>
and
<%= builder.text_field :end_time, "data-role" => "datebox", "defaultPickerValue" => "[12,0]", "data-options" => '{"mode": "timebox", "minuteStep":15 }'%>
Is it only possible to set by script on on load?
Upvotes: 0
Views: 632
Reputation: 57309
You can do it whenever you want.
Take a look at this example:
var defaultPickerValue = [12, 0, 0]; // 12 hour, 0 minutes, 0 seconds
$('#datePickerID').data('timebox').options.defaultPickerValue = defaultPickerValue;
Use this format to set any other needed option.
Or better do it like this. It is an easier solution.
Upvotes: 1