Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82474

problem with tabletools and filter

$
0
0

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());
  }
});

Viewing all articles
Browse latest Browse all 82474

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>