columns.searchPanes.combiner
Set the type of logic to be implemented on the pane.
Please note - this property requires the SearchPanes extension for DataTables.
Description
As standard, SearchPanes will use OR logic when multiple selections have been made. However at times it may be desirable to implement AND logic instead, for example to eliminate rows from the dataset.
Note: When using columns.searchPanes.combiner
along with searchPanes.cascadePanes
you must make sure that your data is appropriate for the selection that you make. searchPanes.cascadePanes
was developed with the default or
logic in mind, using and
logic will work in the majority of cases, but may yield some unexpected results when deselecting in a very small amount of cases.
Note: When using columns.searchPanes.combiner
with array data the row will be returned if all of the selections are present within the array, although other data may also be present.
Type
string
- Description:
By setting the
columns.searchPanes.combiner
option toand
when searching, the pane will apply AND logic rather than the default OR Logic.
Default
- Value:
or
The default value for the columns.searchPanes.combiner
parameter is or
, meaning that as standard the pane will search using OR logic.
Examples
Set the Combiner Option to and Logic:
new DataTable('#myTable', {
layout: {
top1: 'searchPanes'
},
columnDefs: [
{
searchPanes: {
combiner: 'and'
},
targets: [4]
}
]
});
Using the combiner option to eliminate rows:
var dt = new DataTable('#myTable', {
layout: {
top1: 'searchPanes'
},
columnDefs: [
{
searchPanes: {
options: [
{
label: 'Not Edinburgh',
value: function (rowData, rowIdx) {
return rowData[3] !== 'Edinburgh';
}
},
{
label: 'Not London',
value: function (rowData, rowIdx) {
return rowData[3] !== 'London';
}
}
],
combiner: 'and'
},
targets: [3]
}
],
select: {
style: 'os',
selector: 'td:first-child'
},
order: [[1, 'asc']]
});