problem with tabletools and filter
problem with tabletools and filter
I have the following code, but right now filters ar not working with "sDom": '<"H"Tfr>t<"F"ip>', but tabletools buttons works fine, if i change it to 'T<"clear">lrtip tabletools buttons stop working and filters works. I really dont know what to do....
var table = $('#cashout').DataTable({
"bJQueryUI": true,
"sAjaxSource": "CashOutRequest",
"sDom": '<"H"Tfr>t<"F"ip>',
"oTableTools": {
"sRowSelect": "multi",
"aButtons": ["select_all", "select_none"]
},
"bLengthChange": true,
"fnServerData": function (sSource, aoData, fnCallback) {
/Add some extra data to the sender/
aoData.push({ "name": "from", "value": $("#from").val() });
aoData.push({ "name": "to", "value": $("#to").val() });
aoData.push({ "name": "custom" });
sSource.iDataSort
$.getJSON(sSource, aoData, function (json) {
fnCallback(json);
});
$.post(sSource, aoData, function (json) {
fnCallback(json);
});
}
});
jQuery.validator.addMethod(
"validateDate",
function (value, element) {
return value.match(/^(0[1-9]|1[0-2])\/(0[1-9]|1\d|2\d|3[01])\/(19|20)\d{2}$/) || value === "";
}, "Please enter a correct date. Date format mm/dd/yyyy"
);
$("#filterForm").validate({
rules: {
from: {
date: true,
validateDate: true
},
to: {
date: true,
validateDate: true
}
}
});
$("#from").datepicker({
showOn: 'button',
buttonImageOnly: true,
buttonImage: '/Content/imagesDatapicker/icon_cal.png',
"onSelect": function (date) {
minDate = new Date(date).getTime();
var min = new Date(date);
min.setDate(min.getDate());
var dd = min.getDate();
var mm = min.getMonth() + 1;
var y = min.getFullYear();
var minFormated = mm + '/' + dd + '/' + y;
$("#to").datepicker("option", "minDate", minFormated);
}
}).keyup(function () {
minDate = new Date(this.value).getTime();
});
$("#to").datepicker({
showOn: 'button',
buttonImageOnly: true,
buttonImage: '/Content/imagesDatapicker/icon_cal.png',
"onSelect": function (date) {
maxDate = new Date(date).getTime();
var max = new Date(date);
max.setDate(max.getDate());
var dd = max.getDate();
var mm = max.getMonth() + 1;;
var y = max.getFullYear();
var maxFormated = mm + '/' + dd + '/' + y;
$("#from").datepicker("option", "maxDate", maxFormated);
}
}).keyup(function () {
maxDate = new Date(this.value).getTime();
});
$("#filterButton").click(function () {
if ($("#filterForm").valid()) {
table.fnFilter($("#userSearch").val());
}
});
Answers
I find myself and answr: allanallan Posts: 23,403Questions: 0Answers: 659
February 2013
As I said earlier and in other discussions, fundamentally TableTools' client-side processing is not compatible with server-side processing. The whole point of server-side processing is that the full data set is at the server and not the client, while if you want to use TableTools for a full export, you need the full data set on the client-side. That's a design decision you need to make - which you want.