Column search for combinations of comma separated ID's
Column search for combinations of comma separated ID's
I have a DataTable that contains a column with a comma separated list of ID's that can be a maximum length of three values. I then have a select2 search box that will search for those values, in any order, based on the user input.
Here is an example of how it should work:
Search Input:
32, 29
Return results:
32, 22, 29
32, 35, 29
32, 29, 27
32, 29
So in this example, the user enters '32, 29' as the desired search and all of the above rows would be returned.
This is my current code as of now, and it partially works by passing the select2 array values directly into the column search. However, rows are only returned in that specific order, so the row '32,35,29' from my above example is not returned in this case.
$('.filter-content').on('change paste keyup', '#synergies', function() {
var synergy_array = $(this).val();
players_table.columns(45).search(synergy_array, true).draw();
});
Just looking to be pushed in the right direction, and any possible solutions are much appreciated!
Replies
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