Using jquery datatables I want to filter a column which can contain multiple values in a single td.
I followed the datables link
In below picture I want to filter the office column and as you can see one td containsstrong text two values: "Edinburgh" and "New York". Even though the names appear in the filter they don't return a value once selected. For the single elements it is working fine.
So in below example my expected result would be to filter for New York and have a single row returned (including the text of "Edinburgh").
I've created a sample fiddle
$(document).ready(function() {
$('#example').DataTable( {
initComplete: function () {
this.api().columns('.dt-filter').every(function () {
var column = this;
var select = $('<select class="form-control" tabindex="-1" aria-hidden="true" style="max-width:200px"><option></option></select>')
.appendTo($("#filters").find("th").eq(column.index()))
.on('change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val());
column.search(val ? '^' + val + '$' : '', true, false).draw();});
column.data().unique().sort().each( function ( d, j ) {
if (d.indexOf("<p>") >= 0) {
var b = d;
$(b).each(function (index) {
var text = $(this).text();
select.append('<option value="' + text.trim() + '">' + text.trim() + '</option>')
});
}
.....
Is it possible to have multiple values in one column in order to filter by a value?
BTW I just use the p-Element for testing, I don't mind the "li" element or something else.
