KoolReport's Forum

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

DataGrid - rowGroup #375

Open Jure Zakrajsek opened this topic on on Jul 16, 2018 - 9 comments

Jure Zakrajsek commented on Jul 16, 2018

Hi

Is it possible to group rows in a datagrid table like here:

https://datatables.net/examples/advanced_init/row_grouping.html

Thanks for your help Jure

KoolReport commented on Jul 17, 2018

Hi,

Please following the previous rowGroup sample code that I post in your early topics, you may define the "drawCallback" function like this:

..
"drawCallback"=>"function(settings){
    //javascript content
}"
...

By doing so, you will enable the rowGroup like the sample you sent me.

Hope that helps.

Let me know if you need further assistance.

Jure Zakrajsek commented on Jul 17, 2018

Hi

I found a solution.

DataTables suports RowGrouping and it is much easier. Just a simple code like that:

"rowGroup"=>array(
    "dataSrc"=>0,
),
"columnDefs"=>[array(
    "visible"=> false, 
    "targets"=>0,
),
],

Thx for the help

Jure

KoolReport commented on Jul 17, 2018

Awesome!!!

paulo commented on Jun 18, 2020

Hi, I tried this but the column with the group doesn't disappear. Any idea how I can fix this ? Thanks

"dataSource" => $this->dataStore("queryDistribution"),

         "options" => array(
            "searching" => true,
            "fixedHeader" => true,
            "colReorder"=> true,
                "order"=>array(
                             array(1,"asc"), //Sort by first column desc
                         array(0,"asc") //Sort by second column asc
                     ),
                     "rowGroup"=>array(
                         "dataSrc"=>1,
                     ),
                     "columnDefs"=>array(
                         "visible"=> false,
                         "targets"=>1,
                     ),
        ),

(using Laravel)

David Winterburn commented on Jun 19, 2020

Hi Paulo,

If you comment out "fixHeader", "order", "rowGroup" and keep only "columnDefs", does the 2nd (index 1) column show?

paulo commented on Jun 23, 2020

yes, it shows here. thanks

David Winterburn commented on Jun 24, 2020

Would you please open the web page's developer tools (F12) and reload the page to see if there's any js error (normally in red messages)? Thanks!

paulo commented on Jun 24, 2020

good point, I should always remember to do that, sorry. I just checked Console, and it shows DevTools failed to load SourceMap: Could not load content for http://localhost:8000/koolreport_assets/699317815/bootstrap.bundle.min.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

strange because the report is working except for hiding the column.

David Winterburn commented on Jun 25, 2020

Hi Paulo,

Please try DataTables' hide column in an independent report outside of your Laravel to see if it works or not. 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
help needed
solved

DataGrid