responsive-display
The details for a row have been displayed, updated or hidden.
Please note - this property requires the Responsive extension for DataTables.
Description
It can sometimes be useful to know when the end user requests that Responsive show the details of the hidden rows in a column (be it in a child row or a modal), when those details are hidden or when the details have been updated. This event provides that ability.
Please note that, as with all DataTables emitted events, this event is triggered with the dt
namespace. As such, to listen for this event, you must also use the dt
namespace by simply appending .dt
to your event name, or use on()
which will automatically append this name space, as shown in the example below.
Type
function function( e, datatable, row, showHide, update )
- Parameters:
Name Type Optional 1 e
No jQuery event object
2 datatable
No DataTable API instance for the table in question
3 row
No The
row()
for the row whose details are being handled4 showHide
No Flag to indicate if the details are being shown (
true
) or hidden (false
). This value is determined by the function used forresponsive.details.display
.5 update
No Flag to indicate if the details data is being updated (
true
) due to an event such as resizing the table, or the details data is being shown / hidden at the request of the end user (false
).
Example
Listen for details display event using on()
:
var table = new DataTable('#myTable', {
responsive: true
});
table.on('responsive-display', function (e, datatable, row, showHide, update) {
console.log(
'Details for row ' + row.index() + ' ' + (showHide ? 'shown' : 'hidden')
);
});