Cannot set Datatables options for Responsive extension
-
I have the Tablepress Responsive extension, and I am trying to set the
responsive.details.displayoption of Datatables tochildRowImmediateso that the collapsed row details will be immediately expanded on mobile, as per this example. However, Tablepress automatically overrides theresponsiveoptions on initialisation, so they cannot be customised with custom commands.For example, my table has this custom command set:
responsive: { details: { display: $.fn.dataTable.Responsive.display.childRowImmediate, type: '' } }Using this shortcode:
[table id=1 responsive=collapse /]Results in this initialisation:
$('#tablepress-1').dataTable({"stripeClasses":["even","odd"],"ordering":false,"paging":false,"searching":false,"info":false,responsive: { details: { display: $.fn.dataTable.Responsive.display.childRowImmediate, type: '' } },"responsive":true});Note that there are 2
responsiveproperties, the 2nd being added automatically and taking priority over the first.I’ve tried removing the responsive property from the shortcode (
[table id=1 /]) but then the responsive JS extension for Datatables doesn’t load on the page at all, so my options don’t do anything.Thanks for all your work on this great plugin!
The topic ‘Cannot set Datatables options for Responsive extension’ is closed to new replies.