removing serach (bFilter) on multiple tables

removing serach (bFilter) on multiple tables

dy21dy21 Posts: 4Questions: 1Answers: 0

I have a function (tableFunction) that is used by 2 different tables.I am initializing the datatable within tableFunction as follows:

   var oTable = $('#' + tableId).dataTable({
      "bFilter" : false,
      "sScrollY": "108em",
      "bPaginate": false,
      "bRetrieve": true,
      "bSort": true,
      "sDom": '<"H"Cfr>t<"F"ip>',
      "bJQueryUI": true,
      "bAutoWidth": false,
      "pageLength": 100,
      "oColVis": {
          // "activate": "mouseover",
      },
      "bStateSave": true,
      "fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
          $(nRow).attr('id', aData[0]);
          return nRow;
      }
   });

I am also using jeditable with the dataTables plugin, so I am setting up the handlers for editable fields and drop downs within this same function. I call the function for both tables right after the function:

tableFunction('table1');
tableFunction('table2');

If I go to table1, the search box is still there. If I go to table 2, the search box has been removed. Any Idea why it's not removing the search box from table1 as well?

Answers

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    are you using an older version of DataTables as your code indicates for a reason?

  • dy21dy21 Posts: 4Questions: 1Answers: 0

    I have inherited this code and was not aware that I was using an old version. I'm assuming I am using 1.9 instead of 1.10?

  • kthorngrenkthorngren Posts: 21,174Questions: 26Answers: 4,923

    You can use the debugger to see the versions of all Datatables modules you are using:
    https://datatables.net/manual/tech-notes/10#DataTables-debugger

    Kevin

  • dy21dy21 Posts: 4Questions: 1Answers: 0

    Thank you. I have also found the reason for it not working. table1 was being initialized twice, resulting in datatables using an old function that didn't have the bfilter option.

This discussion has been closed.