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.
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:
$(document).ready(function() {
$('#example').DataTable({
dom: 'Plfrtip',
columnDefs: [
{
searchPanes: {
combiner: 'and'
},
targets: [4]
}
]
});
});
Using the combiner option to eliminate rows:
$(document).ready(function() {
var dt = $('#example').DataTable({
dom: 'Plfrtip',
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' ]]
});
});