Using column(x).search(v).draw() doesn't work unless I Destroy() first
Using column(x).search(v).draw() doesn't work unless I Destroy() first
timcadieux
Posts: 76Questions: 22Answers: 0
As mentioned above, I am attempting to use some Buttons to filter to content. Using a button click, I attempt to filter based on a specific column..
The below works IF I use table.destroy...but doing that causes the table to lose its layout?
initComplete: function () {
//Use Buttons to change Region
$('#table-filters').on('click', function (event) {
var v = $(event.target).val();
var i = event.target.id;
var table = new $.fn.dataTable.Api("#datatable");
table.destroy();
table.column(19).search(v).draw();
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Destroying the table doesn't seem like the right solution. I can see that it would loose formatting. Maybe you can put together is simple test case replicating your code so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Thx. I created an example at the link below but mu on click isn't being captured there at all.
http://live.datatables.net/rakuneni/1/
Hi @timcadieux ,
Try this, it should do the trick:
If that doesn't work, 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
That did the job, thank you.