Hi,
After struggling for hours on this I finally ask for help because I can't find how to do what I want. I'm a beginner so I'm not used to use js.
I'm using http://datatables.net/release-datatables/examples/api/multi_filter_select.html and I'd like to understand how can I disable or remove one select input element used to filter a column.
I tried many things without success. I think I also misunderstood the usage of aoColumnDefs which only disable the global search but not the select input filter.
For the moment I added a "visibility:hidden;" on the th tag that I don't want to have the select input.
My issue is pretty similar than the "problem 2" from this topic http://datatables.net/forums/discussion/5942/searchfilter-on-specific-columns-only-not-working/p1
I'm using the code from the example
I've just added an if statement and it's working (I have the select filter only on column 2 to 5) but I know this is not optimized
Thanks for your help
After struggling for hours on this I finally ask for help because I can't find how to do what I want. I'm a beginner so I'm not used to use js.
I'm using http://datatables.net/release-datatables/examples/api/multi_filter_select.html and I'd like to understand how can I disable or remove one select input element used to filter a column.
I tried many things without success. I think I also misunderstood the usage of aoColumnDefs which only disable the global search but not the select input filter.
For the moment I added a "visibility:hidden;" on the th tag that I don't want to have the select input.
My issue is pretty similar than the "problem 2" from this topic http://datatables.net/forums/discussion/5942/searchfilter-on-specific-columns-only-not-working/p1
I'm using the code from the example
$(document).ready(function() {/* Initialise the DataTable */ var oTable = $('#resultTable').dataTable({ "bSort": false, "sPaginationType": "full_numbers", }); // Add a select menu for each TH element in the table header $("thead tr th").each(function (i) {this.innerHTML = fnCreateSelect(oTable.fnGetColumnData(i));$('select', this).change(function () {oTable.fnFilter($(this).val(), i);});}); });
I've just added an if statement and it's working (I have the select filter only on column 2 to 5) but I know this is not optimized
$("thead tr th").each(function (i) { //maybe i !=0 is better here if ((i == 1) || (i == 2)||(i == 3) || (i == 4)) { this.innerHTML = fnCreateSelect(oTable.fnGetColumnData(i)); $('select', this).change(function () { oTable.fnFilter($(this).val(), i); }); } });
Thanks for your help