DataTable Responsive: Prevent details showing on clicking the first column
DataTable Responsive: Prevent details showing on clicking the first column
Hi everyone.
I have a problem preventing expanding detail row when first column is clicked. I need to create a behaviour that user must click on +/- to show/hide details. That's because clicking a row must just select it. What is more, layout of table must be as shown here https://datatables.net/extensions/responsive/examples/initialisation/className.html, so that +/- are is a part of first column with a text, +/- can't be a separate column!
I've made this peace of code that shows details when +/- is clicked without row being selected:
$(document).off('click', app.dataTableSelector+' tr').on( 'click', app.dataTableSelector+' tr', function (event) {
var elementClass = app.parseValue($(event.target).attr('class'), 'string', '');
if(elementClass.indexOf('details-control') === -1 || event.offsetX > 25){
$(this).toggleClass('selected');
}
} );
I think it'd be a good thing to add similar behaviour to future release or make it an option.
Can anyone help? Thank you in advance!