KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.

Datatables grouping broken #945

Closed Rooze McKelvey opened this topic on on Jun 25 - 18 comments

Rooze McKelvey commented on Jun 25

At one point, this table was grouping by the Status field (as well as hiding the status column). Now neither of those are working. Can you help me pinpoint why it no longer groups and hides?

<?php
    DataTables::create(array(
        "dataSource"=>$this->dataStore('client_tasks_by_project_id'),
        "options"=>[

          "order"=>array(
            [3,'asc'],
            [0,'asc']),
          "ordering"=> false,
          "rowGroup"=>array(
            "dataSrc"=>[3]),
            "columnDefs"=>array(
                array("visible"=> false,"targets"=>3),
                  )
        ],


        "columns"=>array(


                      "ID"=>array(
                        "label"=>"",
                        "formatValue"=>"<button type='button' class='deletebtn'>Omit @value</button>"
                      ),

            "Task"=>array(
                "label"=>"",
                 "autoWidth"=>true
            ),

            "Description"=>array(
                "label"=>"",
                 "autoWidth"=>true,
                "formatValue"=>function($value)
                  {
                   if($value!="-")
                   {return $value;
                   } else {
                     return "";
                     }}
              ),

              "Status"=>array(
                  "label"=>"",
                   "autoWidth"=>true
              ),

            "File"=>array(
              "label"=>"",
               "autoWidth"=>true,
              "formatValue"=>function($value)
                {
                 if($value!="-") {return "<a href='https://teamkrs.com/uploads/attachments/".$value."' target=_blank><img height='auto' width='450px' src='https://teamkrs.com/uploads/attachments/".$value."' /></a>";

                 } else {
                   return "<img height='auto' width='450px' src='https://reports.teamkrs.com/assets/images/no-image-available.jpg'/>";
                   }}
            )
        ),

        "cssClass"=>array(
            "table"=>"table-bordered table-striped table-hover table-responsive",
            "td"=>function($row,$columnName){
              return ($columnName=="ID")?"noprint":"";
    }

        )
    ));
    ?>

Thank you!

David Winterburn commented on Jun 26

Hi Rooze,

Would you mind sending a screenshot of your datatables? Please open the developer panel (F12) to see if there's any error (red lines) in the Console tab. And finally let us know which version of Datagrid you are using. Thanks!

Rooze McKelvey commented on Jun 26

Hi, David,

I'm on Version 3.0.0 of Datagrid. Screenshot attached.

David Winterburn commented on Jun 27

Hi Rooze,

Do you mind trying to update Datagrid to version 3.1.0 just to see if it solves this problem of yours. Thanks!

Rooze McKelvey commented on Jun 27

Hi, David,

Updated Datagrid but still having the same issue. Here's a copy of the datasource code, just in case that's doing something it shouldn't be doing:

//Creates datastore tasks_by_project_id; used for displaying tasks and associated comments and files
       $this->src('teamKRS')
       ->query(MySQL::type(DB::table("tasks")
         ->where([
           ['tasks.projects_id',$projID],
           ['tasks.in_trash',NULL]
         ])

 ->leftjoin("tasks_status",'tasks.tasks_status_id','=','tasks_status.id')
 ->leftjoin('tasks_comments', function ($join) {
 $join->on('tasks.id','tasks_comments.tasks_id')
          ->where('tasks_comments.in_trash',NULL)
          ;
        })
 ->leftjoin('attachments',function ($join) {
 $join->on('tasks_comments.id','attachments.bind_id')
          ->where('attachments.bind_type','comments');
        })
   ->select('tasks.id')->alias('Task ID')
      ->addselect('tasks.id')->alias('ID')
   ->addSelect('tasks.name')->alias('Task')
   ->addSelect('tasks_status.name')->alias('Status')
   ->addSelect('attachments.file')->alias('File')

   ->leftjoin('extra_fields_list',function ($join) {
   $join->on('tasks.id','extra_fields_list.bind_id')
            ->where('extra_fields_list.extra_fields_id', '111');
          })
     ->select('extra_fields_list.value')->alias('Description')
      ))


      ->pipe($this->dataStore("client_tasks_by_project_id"));
David Winterburn commented on Jun 28

Hi Rooze,

Would you please send us a link to your page via email support@koolphp.net? Thanks!

Rooze McKelvey commented on Jun 28

Sent!

David Winterburn commented on Jul 1

Thanks, Rooze! Since we couldn't send email to you (there's delivery problem with it), here's our reply:

Thanks for your link! When I investigated the page, it seems the page couldn’t load KoolReport.js: <script type='text/javascript' src='/reports/koolreport/src/clients/core/KoolReport.js'></script>

This is the reason DataTables couldn’t be initiated. Would you please let us know the correct path to koolreport on your server and attach your report’s php page for us to see how to fix it. Thanks!

Rooze McKelvey commented on Jul 2

The koolreport folder is up one level from the report's php page and is at the root of the public directory. I checked and the KoolReport.js file is in the right path. The one thing I can see is that the source should be at '/koolreport/...' rather than have the initial "reports" directory.

The rest of the DataTables is working correctly, though? Meaning the data is displaying in a table.

Here's the report's php file as well.

https://www.dropbox.com/s/vn7w3hld8xaktyn/ClientReport.view.php?dl=0&m=

If you need FTP access, please let me know and I'll email it that to you. Thanks.

David Winterburn commented on Jul 3

Hi Rooze,

Would you please send the php code for ClientReport.php as well? Thanks!

Rooze McKelvey commented on Jul 3

https://www.dropbox.com/s/dmqmgqk1kwgu3fg/ClientReport.php?dl=0&m=

Rooze McKelvey commented on Jul 9

Any update on this? Thanks.

David Winterburn commented on Jul 10

Sorry, Rooze! It looks like your report extends BaseReport and doesn't have a setting method. Do you mind posting php code for BaseReport as well? I suspected your report had wrong asset path property in its setting method. Thanks!

Rooze McKelvey commented on Jul 10

I'll email you the link since it has our connection information.

Rooze McKelvey commented on Jul 18

Any update?

David Winterburn commented on Jul 19

Hi Rooze,

Would you please send us a fpt access to your site via email? We could help fixing this strange problem faster that way. Thanks!

Rooze McKelvey commented on Jul 22

Sent!

David Winterburn commented on Jul 23

Hi Rooze,

We've fixed the koolreport's resource (js) path issue in your project. The rowgroup should work fine now. The fix is available in newer versions of KoolReport as well. So when you upgrade koolreport in the future your project doesn't need this fix. Thanks!

Rooze McKelvey commented on Jul 23

Works great; thank you!

KoolReport Is Free and Open-Source!

KoolReport is a professional php reporting framework which saves you tons of time to construct dynamic data report & dashboard.

  • Connect to various datasources such as MySQL, SQL Server, MongoDB or even from CSV or Excel file.
  • Contain series of powerful built-in data processes for your data manipulation.
  • Generate stunning charts and graphs to help you communicate data insights to your audiences effectively.
  • Integrate seamlessly with any php frameworks such as Laravel, CodeIgniter, Symfony.
Download Now and register our tutorials to get started!

Download KoolReport
solved

DataGrid