because of the filters that I apply in a dataTable affects others?
because of the filters that I apply in a dataTable affects others?
emmanuel921218
Posts: 11Questions: 4Answers: 0
I have three dataTables but I only apply the filters to one, but when I start the page the other tables start filtered.
I share how I initialize the tables. The first is in which I apply the filters, and the second is one that is affected.
1.-
var genealogytable = $('#genealogy').DataTable({
//stateSave: true,
destroy: true,
processing: true,
// ajax: "reloadTab/?idsponsor=" + idsponsor + "&&period=" + period + "&&type=" + typee,
ajax: "http://mynikkentest.nikkenlatam.com/reloadTab/?idsponsor=" + idsponsor + "&&period=" + period + "&&type=" + typee,
deferRender: true,
columns: [
{
data: null,
className: "center",
defaultContent: '<td> <p><label> <input type="checkbox" id="emailGenealog[]" name="email[]" class="check_mailGenealogy" onclick="mailRowGen(this.parentNode.parentNode.parentNode.parentNode.id)" name="countries[]" value="" /><span></span></label></p> </td>'
},
{data: 'Line'},
{data: 'Level'},
2.-
$('#signupNew').DataTable({
//stateSave: true,
destroy: true,
processing: true,
ajax: "signupNew/{{ $ids }}",
deferRender: true,
columns: [
{data: 'SignupDate'},
{data: 'associateid'},
{data: 'associatename'},
{data: 'SponsorName'},
{data: 'PV'},
{data: 'GV'},
{data: 'OV'},
{data: 'QOVOPL'},
{data: 'QOVOPSL'},
]
});
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This discussion has been closed.
Answers
How are you applying the filters? There is nothing in those table declarations that would cause any interference.
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
I'm sorry I'm new, and I don't know how to do that, I'll read what is due
$ ('# updatefilter'). click (function () {
genealogytable.draw ();
});
That's not applying a filter, it's just doing a draw - so we'd really need to see this to be able to progress it.
sorry, this is
$('#updatefilterDonw').keyup( function() {
genealogytable.draw();
} );
Solve the problem this way
// setup an array of the ids of tables that should be allowed
var allowFilter = ['productTable'];
$.fn.dataTableExt.afnFiltering.push(function(oSettings, aData, iDataIndex) {
});