Register datepicker with the datatables ajax call
Register datepicker with the datatables ajax call
I am wondering how to make my datepicker make an ajax request to the server. I have created a feature plugin to include the datepicker in the sDom and my code doesn't seem to be registered with the datatables.
[code]
var DatePicker = function(oDTSettings) {
oDTSettings.aoDrawCallback.push({
"fn" : function() {
var label = $("").attr('for', "from").text('Date:');
var input = $('').attr({id: 'from', name: 'from'});
input.appendTo(label);
$("#datepicker").append(label);
input.datepicker({onSelect: function(fromDate, inst){
$.ajax({"type": "POST",
"url": ".......?fromDate=" +fromDate
});
}});
},
"sName" : "DatePickerControl"
});
};
$.fn.dataTableExt.aoFeatures.push( {
"fnInit": function(oDTSettings) {
return new DatePicker(oDTSettings);
},
"cFeature": "D",
"sFeature": "DatePickerControl"
});
[/code]
[code]
var DatePicker = function(oDTSettings) {
oDTSettings.aoDrawCallback.push({
"fn" : function() {
var label = $("").attr('for', "from").text('Date:');
var input = $('').attr({id: 'from', name: 'from'});
input.appendTo(label);
$("#datepicker").append(label);
input.datepicker({onSelect: function(fromDate, inst){
$.ajax({"type": "POST",
"url": ".......?fromDate=" +fromDate
});
}});
},
"sName" : "DatePickerControl"
});
};
$.fn.dataTableExt.aoFeatures.push( {
"fnInit": function(oDTSettings) {
return new DatePicker(oDTSettings);
},
"cFeature": "D",
"sFeature": "DatePickerControl"
});
[/code]
This discussion has been closed.
Replies