0
我有一個代碼來過濾dataTables到日期。問題是,代碼工作正常,但只有當Y型與鍵盤的日期,而不是挑喜歡的圖像日期:jQuery Datepicker onClose
如何can'i設置datapicker的OnClose選項:
$(document).ready(function(){
$('#data .input-daterange').datepicker({
todayBtn: "linked",
keyboardNavigation: false,
forceParse: false,
autoclose: true,
format: "dd-mm-yyyy",
onClose: ????????????????
},
});
/* Add event listeners to the two range filtering inputs */
$('#min, #max').keyup(function() { oTable.draw(); });
});
使在這個代碼配置的dataTables工作過濾器?
/* Function for date filter */
jQuery.fn.dataTableExt.afnFiltering.push(
function(oSettings, aData, iDataIndex) {
var iMin = document.getElementById('min').value;
var iMax = document.getElementById('max').value;
var iMinimo_year = iMin.substring(6,10);
var iMinimo_month = iMin.substring(3,5);
var iMinimo_day = iMin.substring(0,2);
var iMinimo = iMinimo_year.concat(iMinimo_month,iMinimo_day);
var iMaximo_year = iMax.substring(6,10);
var iMaximo_month = iMax.substring(3,5);
var iMaximo_day = iMax.substring(0,2);
var iMaximo = iMaximo_year.concat(iMaximo_month,iMaximo_day);
var iCol = 5;
var iDate_year = aData[iCol].substring(6,10);
var iDate_month = aData[iCol].substring(3,5);
var iDate_day = aData[iCol].substring(0,2);
var iDate = iDate_year.concat(iDate_month,iDate_day);
if ((iMinimo === "" && iMaximo === "") || (iMinimo <= iDate && iMaximo === "") || (iMinimo === "" && iMaximo >= iDate) || (iMinimo <= iDate && iMaximo >= iDate)) {
return true;
} else {
return false;
}
}
);
的HTML部分是:
`<div class="form-group col-md-offset-4" id="data">
<label class="font-noraml">Seleccione rango de fechas de ingreso de solicitud a filtrar</label>
<div class="input-daterange input-group" id="datepicker">
<input type="text" class="input-sm form-control" name="min" id="min" value="<?php echo date('');?>"/>
<span class="input-group-addon">a</span>
<input type="text" class="input-sm form-control" name="max" id="max" value="<?php echo date('d-m-Y');?>" />
</div>
</div>
`
你可以在這裏粘貼代碼,當您手動鍵入日期執行? – void
是否上面的代碼,onClose行除外: – rjgodoy