KoolReport's Forum

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

Datagrid collapseAllGroups uncaught error #2654

Open Rajesh Kumar opened this topic on on Apr 29, 2022 - 4 comments

Rajesh Kumar commented on Apr 29, 2022

Hi, when using datagrib rowgroup collapse, I am getting this error. Please suggest a solution.

Bonnie

Uncaught TypeError: KRMyTable1.collapseAllGroups is not a function

at x.action ((index):126826:281)
at h (datatables.min.js:255:229)
at HTMLButtonElement.<anonymous> (datatables.min.js:256:67)
at HTMLButtonElement.dispatch (jquery.min.js:2:42571)
at HTMLButtonElement.v.handle (jquery.min.js:2:40572)

action @ (index):126826 h @ datatables.min.js:255 (anonymous) @ datatables.min.js:256 dispatch @ jquery.min.js:2 v.handle @ jquery.min.js:2

KoolReport commented on May 1, 2022

Hi Rejesh, we are sorry for the late reply. I need to consult dev.team about this isuse and unfortunate is that we are currently under national holiday so I promise to get you a dev.team member to answer you as soon as possible.

Sebastian Morales commented on May 2, 2022

Hi, this could be a problem not DataTables' cached js files not refreshing. Pls open your browser's dev tool, tab Network, look for url path to KRDataTables.js and delete the koolreport_assets' subdirectory that contains KRDataTables.js in your file system to force the browser to update to a new KRDataTables.js file. Let us know if you have any difficulty with these steps. Tks,

Rajesh Kumar commented on May 2, 2022

Hi Sebastian,

I don't see there is a koolreport_assets directory. This is the link for the report. https://dev03.resilion.net/analytics/subidrev/

Here is the code, basically from the example given: <div class="report-content">

<div class="text-center">
    <h1>Sub ID Revenue</h1>
    <p class="lead">
    Yesterday Sub ID Revenue Report
    </p>
</div>
<style>
    tr[role="row"] td:first-child {
        padding-left: 50px;
    }
</style>
<?php

 DataTables::create(array(
    "name" => "MyTable1",
    "dataSource"=>$this->dataStore("subidRev"),
    "themeBase"=>"bs4", // Optional option to work with Bootsrap 4
    "cssClass"=>array(
        "table"=>"table table-striped table-bordered"
    ),
	//RecordDate, RecordHour, Segment, DeviceType, Country, subidgid, utm_source, subidaid, subidcid, Sessions, Pageviews, Impressions, PaidClicks, Revenue
    "plugins" => [ "Buttons" ],
    "columns" => ["Segment", "subidgid", "DeviceType","Revenue"],
    "clientRowGroup" => [
        "Segment" => [
            'direction' => 'asc',
            "top" => "<td colspan='999'>{expandCollapseIcon} Segment: {Segment}</td>",
        ],
        "subidgid" => [
            'direction' => 'asc',
            "top" => "<td colspan='999'>{expandCollapseIcon} SubID: {subidgid}</td>",
        ],
    ],
	
    "options" => [
        "fastRender" => true,
        "paging" => true,
        "searching" => true,
        "pageLength" => 50,
        // "dom" => 'Blftip',
        "dom" => "<'row mb-2'<'col-12 text-right'B>>" . "<'row'<'col-sm-6'l><'col-sm-6'f>>" 
            . "<'row'<'col-sm-12'tr>>" . "<'row'<'col-sm-5'i><'col-sm-7'p>>",
        "buttons" => [
            [
                "text" => 'Collapse group 1',
                "action" => "function() { KRMyTable1.collapseAllGroups(0); }",
            ],
            [
                "text" => 'Collapse sub id',
                "action" => "function() { KRMyTable1.collapseAllGroups(1); }",
            ],
            [
                "text" => 'Expand Customers',
                "action" => "function() { KRMyTable1.expandAllGroups(0); }",
            ],
            [
                "text" => 'Expand Categories',
                "action" => "function() { KRMyTable1.expandAllGroups(1); }",
            ],
            
            [
                "text" => 'Toggle Customers',
                "action" => "function() { KRMyTable1.toggleAllGroups(0); }",
            ],
            [
                "text" => 'Toggle Categories',
                "action" => "function() { KRMyTable1.toggleAllGroups(1); }",
            ],
        ],
    ],
    "onReady" => "function() {
        MyTable1.on( 'draw.dt', function () {
            console.log( 'event draw' );
            KRMyTable1.collapseAllGroups(0);
			KRMyTable1.collapseAllGroups(1);
           
        } );
        KRMyTable1.collapseAllGroups(0);
		KRMyTable1.collapseAllGroups(1);
        
    }",
));

?>

</div>

Sebastian Morales commented on May 4, 2022

Hi Rajesh, would you pls open the file koolreport/datagrid/composer.json and let us know which version number it has? Tks,

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
help needed

None