Note that there are some explanatory texts on larger screens.

plurals
  1. PODatepicker onchangemonthyear beforeshowday
    primarykey
    data
    text
    <p>I have the datepicker on a modal of twitter bootstrap. in order to highlight some dates, the datepicker is generated in the 'success'-part as an ajax-call.</p> <p>I manage to highlight the dates I want to highlight in the current month, which is fine.</p> <p>But when I toggle to the previous or next month, I would like to make that ajax-call again and render dates to highlight. Below you can see my code:</p> <pre><code>function nonValidated() { var date = new Date(); date.addDays(-date.getDate() + 1); var startDate = [date.getDate().lpad(2), (date.getMonth() + 1).lpad(2), date.getFullYear()].join('/'); var enddate = new Date(); enddate.setDate(date.getDaysInMonth()); var endDate = [enddate.getDate().lpad(2), (enddate.getMonth() + 1).lpad(2), enddate.getFullYear()].join('/'); var depId = $('#serviceSelector').val(); $.ajax({ type: "POST", url: "/ServiceManagement/GetUnassignedSlots", data: { "from": startDate, "to": endDate, "depId": depId }, success: function (data) { $.datepicker.setDefaults( $.extend( { 'dateFormat': 'dd/mm/yy' }, $.datepicker.regional['nl-BE'] ) ); $("#nonValidatedDatepicker").datepicker( { inline: true, beforeShowDay: function (date) { var theday = date.getDate() + '/' + (date.getMonth() + 1).lpad(2) + '/' + date.getFullYear(); return [true, $.inArray(theday, data.result) &gt;= 0 ? "warningDate" : '']; }, onSelect: function (dateText, inst) { var dateParts = dateText.split('/'); if (dateParts[0][0] == '0') dateParts[0] = dateParts[0][1]; if (dateParts[1][0] == '0') dateParts[1] = dateParts[1][1]; var newdate = new Date(dateParts[2], dateParts[0]-1, dateParts[1]); var dayOfWeek = newdate.getDay(); if (dayOfWeek == 0) dayOfWeek = 7; var weekstart = new Date(newdate.getFullYear(), newdate.getMonth(), newdate.getDate()); weekstart.addDays(-dayOfWeek + 1); var weekend = new Date(newdate.getFullYear(), newdate.getMonth(), newdate.getDate()); weekend.addDays(7 - dayOfWeek); $('#SelectWeekDate').val([weekstart.getDate().lpad(2), (weekstart.getMonth() + 1).lpad(2), weekstart.getFullYear()].join('/') + ' - ' + [weekend.getDate().lpad(2), (weekend.getMonth() + 1).lpad(2), weekend.getFullYear()].join('/')); $('#modalNonValidated').modal('hide'); InitFillPage(); }, onChangeMonthYear: function (year, month, widget) { } } ); }, error: function (data) { }, statusCode: { 401: function (data) { //ERROR 401: Unauthenticated window.location.href = '/Account/Login?ReturnUrl=' + encodeURIComponent(window.location.pathname); } } }); } </code></pre> <p>anyone an idea how I can combine onchangemonthyear and beforeshowday?</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.
 

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