KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Auto collapse of Datagrid Rowgroup #2286

Open Gal Engineers opened this topic on on Aug 18, 2021 - 2 comments

Gal Engineers commented on Aug 18, 2021

Hi

I am using the Rowgroup as described here: https://www.koolreport.com/examples/reports/datagrid/client_rowgroup/

However I need all groups to be collapsed by default when entering the page, how can this be done? I tried manually the following JS but it seems to run too early:

	$(document).ready(function() {
		$('.group-collapse').trigger('click');
	});
Sebastian Morales commented on Aug 19, 2021

How about you put your function in the "onReady" event of DataTables:

<script>
    function initCollapse() {
	$(document).ready(function() {
		$('.group-collapse').trigger('click');
	});
    }
</script>
<?php
DataTables::create(array(
    ...
    "onReady" => "initCollapse"
));

Let us know how it works for you. Tks,

Gal Engineers commented on Aug 19, 2021

Works! thanks!

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
solved

None