Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery onselect datetimepicker change
    primarykey
    data
    text
    <p>Using the datetime picker from <a href="http://trentrichardson.com/examples/timepicker/" rel="nofollow">http://trentrichardson.com/examples/timepicker/</a>, I have to change the max hour when the user clicks a specific date. So far my code makes an AJAX call and gets the max hour on every click of the day(max hour diffrent everyday and lives in databse).</p> <p>Now I was trying to refresh the view so that the updated maxhour is shown but the form resets to "janaury 0" and when I close the form and click it back the maxhour of the last request if applied to any day selected.</p> <p>To reset the form i have used options method, that didn't work so i have a method which is called on every <code>onselect</code> event that destroys the old property of the datetimepicker and remakes everything and assigns the property.</p> <p>I even tried using the refresh method of the datetpicker that was supposed to refresh the view.</p> <p>initial assignment</p> <pre><code>$("#startDate").datetimepicker({ onSelect: function (date) { manipulate(date); }, timeFormat: 'hh:mm:ss tt', hourMin: 8, hourMax: endHour, showSecond: false, stepMinute: 15, minuteGrid: 5, addSliderAccess: true, sliderAccessArgs: { touchonly: false }, showOn: "button", buttonText: "Select a date to check out equipment(s).", buttonImage: "../images/calendar.gif", buttonImageOnly: true, defaultDate: "+0", changeMonth: false, numberOfMonths: 2, minDate: 0, maxDate: '+5w', beforeShowDay: unavailable, ampm: true }); function manipulate(date) { var sendDate = date.toString(); jQuery.ajax({ url: "endtime.php", data: { day: sendDate }, type: "POST", success: function (XML) { var answer = jQuery("data", XML).text(); var time = answer.split(":"); var timetemp = sendDate.split(" "); var timenew = timetemp[0] + " " + answer; //$("#startDate").datetimepicker.( "option" ,hourMax ,time[0]); this is one of the first approach $("#startDate").datetimepicker("destroy"); //$("#startDate").datetimepicker("refresh"); var DateOptions = { onSelect: function (date) { manipulate(date); //$("#startDate").datetimepicker("refresh"); //datepicker._gotoToday('#startDate'); }, timeFormat: 'hh:mm:ss tt', hourMin: 8, hourMax: time[0], showSecond: false, stepMinute: 15, minuteGrid: 5, addSliderAccess: true, sliderAccessArgs: { touchonly: false }, showOn: "button", buttonText: "Select a date to check out equipment(s).", buttonImage: "../images/calendar.gif", buttonImageOnly: true, defaultDate: "+0", changeMonth: false, numberOfMonths: 2, minDate: 0, maxDate: '+5w', beforeShowDay: unavailable, ampm: true, setDate: date } $("#startDate").datetimepicker(DateOptions); } }) } </code></pre> <p>Any help will be appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload