Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I was having a similar problem. I was adding custom buttons to the bottom of the datepicker (using $(id).append), but when I would select a date the datepicker would refresh and destroy them.</p> <p>This is the date selection function for the datepicker in the jquery-ui library:</p> <pre><code>_selectDate: function(id, dateStr) { ... if (onSelect) onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); ... if (inst.inline) this._updateDatepicker(inst); ... }, </code></pre> <p>As you can see, the function first calls the onSelect event, and then calls _updateDatepicker (which is what redraws the form) if inst.inline is true.</p> <p>This is my workaround to prevent the form from refreshing while maintaining the selection functionality:</p> <pre><code>$("#cal_id").datepicker({ onSelect: function(date, inst){ //This is the important line. //Setting this to false prevents the redraw. inst.inline = false; //The remainder of the function simply preserves the //highlighting functionality without completely redrawing. //This removes any existing selection styling. $(".ui-datepicker-calendar .ui-datepicker-current-day").removeClass("ui-datepicker-current-day").children().removeClass("ui-state-active"); //This finds the selected link and styles it accordingly. //You can probably change the selectors, depending on your layout. $(".ui-datepicker-calendar TBODY A").each(function(){ if ($(this).text() == inst.selectedDay) { $(this).addClass("ui-state-active"); $(this).parent().addClass("ui-datepicker-current-day"); } }); } }); </code></pre>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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