KoolReport's Forum

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

Only expand one level #837

Open victor opened this topic on on Apr 27, 2019 - 1 comments

victor commented on Apr 27, 2019

Hi!!!, I need expand a current year but not the last year for default It's possible.? And the change only the name of the total in the Header , not in the row. It's possible too?

I need this view for default

David Winterburn commented on Apr 30, 2019

Hi,

To expand/collapse a certain header, please use javascript to find your header, then trigger the click event of its expand/collapse icon. Similarly, you could change the Total text of your column header. So in your case, I would try adding this to the end of your page:

<script type=\"text/javascript\">
		KoolReport.load.onDone(function() {
			var colHeaders = document.querySelectorAll(".pivot-column-header");
                        var currentYearHeaders = null;
                        for (var i=0; i<colHeaders.length; i+=1) {
                            if (colHeaders[i].textContent.trim() == 2019) {
                                currentYearHeaders = colHeaders[i];
                            }
                            if (colHeaders[i].textContent.trim() == "Margen") {
                                colHeaders[i].textContent = "TOTAL";
                            }
                        }
                        var icon = currentYearHeaders.querySelector(".fa");
                        icon.click();
		} );
</script>

There could be bug in my code but the idea stands. Please use your browser deveveloper console (F12) to debug it if needed. Let us know if you have any difficulty. 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
None yet

None