0

It works properly for one word categories, however if there are spaces in between it doesn't show results.I'm not quite sure how to fix it, can you please check my code and let me know what is not working? Many thanks!

function applyFilters() {
    var categorySearch = categoryFilters.length > 0 ? categoryFilters.map(function(f) { return '\\b' + f.replace(/\s+/g, '\\s+') + '\\b'; }).join('|') : '';

    console.log('Category Search:', categorySearch); // Debug message

    table.column(5).search(categorySearch, true, false);
}

I need filtering words that have spaces in between, for instance, more than one words sentences.

2
  • Please read minimal reproducible example - and then provide a MRE in the question, using a runnable stack snippet. Please also take the time to read How to Ask and browse other relevant help center topics. Commented Jul 3 at 18:06
  • As it stands, the question is missing important details. We have to make some guesses as to why this problem is happening - and I, for one, cannot recreate your problem. Your code works correctly for me. Commented Jul 3 at 18:06

0

Browse other questions tagged or ask your own question.