SearchBuilder does not honor orthogonal option for column
SearchBuilder does not honor orthogonal option for column

Link to test case: https://live.datatables.net/juberumi/2/edit?html,js,console,output
Debugger code (debug.datatables.net): NA
Error messages shown: NA
Description of problem: One of my table columns starts with some general information and then outlines specifics in a span. For SearchBuilder, I only want to show the general information in the dropdown, not the specifics.
The setup of the column is shown below (also see test case).
I used one of your examples (https://datatables.net/extensions/searchbuilder/examples/customisation/orthogonal.html) and modified it to reflect my situation. Based on your example and documentation (https://datatables.net/reference/option/columns.searchBuilder.orthogonal), I expect the dropdown to no longer include the span, but it still shows up. The console.log shows that for filtering, the unwanted part is cut off.
What am I doing wrong?
{
data: 'rating', title: 'rating',
searchBuilder: {
orthogonal: {
display: 'filter'
}
},
render: function (data, type, row, meta) {
var thisval=null;
if (data === "" || data === null) thisval=data;
else if (type === 'filter') {
var pos = data.indexOf('<span class="what');
if (pos > 0) thisval=data.substring(0,pos-1);
else thisval=data;
}
else thisval=data;
console.log('type: ' + type + ' thisval: ' + thisval);
return data;
}
},
Many thanks,
Beate
This question has an accepted answers - jump to answer
Answers
The problem is you have
return data;
which is returning the original column data. You should be returningthisval
. Updated test case:https://live.datatables.net/juberumi/3/edit
Kevin
Duh! How embarrassing, I should have slept over it! Thank you!
It's easy to miss something simple
Happens all the time to me.
Kevin