searchPanes.filterChanged
Function to update title text when selections are made.
Please note - this property requires the SearchPanes extension for DataTables.
Description
This function is called every time the number of SearchPanes options that have been selected changes. As default this is used to update the SearchPanes title (set using the searchPanes.i18n.title
config option alongside an i18n()
api call).
The SearchPanes button also uses this configuration option to update the button text to reflect the selection numbers (text is set using searchPanes.i18n.collapse
and an i18n()
api call).
The context of the function is the DataTables instance, meaning that API methods can be called directly from within the function. For example, this.i18n(...);
.
Note: When using this function with searchPanes.cascadePanes
this function is likely to run multiple times. This is simply down to how searchPanes.cascadePanes
is implemented.
Type
function searchPanes.filterChanged(count)
- Parameters:
Name Type Optional 1 count
No Number of options selected in SearchPanes.
Example
Set text for custom element:
new DataTable('#myTable', {
layout: {
top1: {
searchPanes: {
filterChanged: function (count) {
$('.SPDetails').text(
this.i18n(
'searchPanes.collapse',
{ 0: 'Advanced filter', _: 'Advanced filter (%d)' },
count
)
);
}
}
}
}
});