KoolReport's Forum

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

Fixed First Column #1994

Open Alex opened this topic on on Mar 25, 2021 - 15 comments

Alex commented on Mar 25, 2021

Hello,

I see the ease to fix the header row, but I do not see any documentation to set a fixed column.

Does this exist?

KoolReport commented on Mar 25, 2021

If you want to have the fixed first column features, please use the DataTables widget from DataGrid packages.

Alex commented on Apr 26, 2021

Hello,

I have reviewed the features of the Data Tables widget, but I do not see any documentation around "freezing" the first column. I see documentation around freezing the header row, which I included as a picture for reference, but nothing further.

Could you please point me in the right direction? Thanks for your help!

This is where I have been reviewing:

https://www.koolreport.com/docs/datagrid/datatables/#format-column-value

Sebastian Morales commented on Apr 27, 2021

Pls check this example of fixed columns for DataTables in client side setting:

https://datatables.net/extensions/fixedcolumns/examples/initialisation/left_right_columns.html

You could convert those options to PHP array and use them in DataTables widget like this:

DataTables::create(array(
    ...
    "options" => array(
        "scrollY" => "300px",
        "scrollX" => true,
        "scrollCollapse" => true,
        "paging" => false,
        "fixedColumns" => array(
            "leftColumns" => 1,
            "rightColumns" => 1
        )
    ),
));

Let us know how it works for you. Tks,

Lalitha commented on Nov 3

Hi, how can i freeze the first column in the datatable using koolreport, in every data table present in my kool reports.. Please help me out

Sebastian Morales commented on Nov 7

Pls try the "fixedColumns" plugin:

https://www.koolreport.com/docs/datagrid/datatables/#plugins-(version-%3E=-4.0.1)

DataTables::create(array(
    ...
    "plugins"=>array("FixedColumns"),
    "options" => array(
        "scrollY" => "300px",
        "scrollX" => true,
        "scrollCollapse" => true,
        "paging" => false,
        "fixedColumns" => array(
            "leftColumns" => 1,
            "rightColumns" => 1
        )
    ),
)); 
Lalitha commented on Nov 7

"plugins" => ["FixedHeader","FixedColumns"],

                                                        "options" => array(
                                                            "colReorder" => true,
                                                            "scrollY" => "500px",
                                                            "scrollX" => true,
                                                            "scrollCollapse" => true,
                                                            "fixedHeader"=>true,
                                                            // "fixedColumns" => array(
                                                                //     "leftColumns" => 2  
                                                                // ),
                                                                "select" => true,
                                                                "ordering" => false,
                                                            ),
                                                            "responsive"=>true,
                                                            "showFooter"=>true,
                                                            "title"=>"State Wise Net Volume Sale",            

I have already done this. It is showing state name , i mean the very first column data 2 times( like abc down again abc). and the internal linking is also breaking.When we tried to click on the data it is not displaying/working. It is freezing but not working , other modules are creating many disturbances

Sebastian Morales commented on Nov 8

Pls post your DataTables full create code and screenshots of the problem when comparing to not using fixedColumns. Tks,

Lalitha commented on Nov 10
<?php
require_once(dirname(__FILE__) . "/../../../layout/header.php");
use \koolreport\drilldown\DrillDown;
use \koolreport\processes\CopyColumn;
use \koolreport\processes\DateTimeFormat;
use \koolreport\widgets\google\ColumnChart;
use \koolreport\widgets\koolphp\Table;
use \koolreport\inputs\DateRangePicker;
use \koolreport\inputs\Select;
use \koolreport\datagrid\DataTables;
?>
<BR/>
<style>
.label-select { border: none;
    background: none;
    background-image: none;
    margin-bottom: 20px;
    font-weight: 600;
    pointer-events: none;
    font-size: 16px;
}
select.label-select {
    /* for Firefox */
    -moz-appearance: none;
    /* for Chrome */
    -webkit-appearance: none;
}

/* For IE10 */
select.label-select::-ms-expand {
    display: none;
}

</style>

<div class="report-content">
   <!-- <div class="text-center">
        <div><h1><strong>Volume Sales Report</strong></h1></div>
    </div>    -->
        <!-- <BR>-->
        <div class="border-top my-3"></div>

            <div class="row">
            <div class="col-md-8 offset-md-12">
                <label><strong><h3>Select the Year to view Volume Sales Report:</h3></strong></label>
                </div>
            </div>    
            <div class="row">
                <div class="col-md-8 offset-md-12" >
                <?php
                //console.log('!!!!!!!!!!!'+$_GET['yearinfo']);
                Select::create(array(
                    //"placeholder" => "Select year",
                    'name' => "yearinfo",
                    'id'=>"yearinfo",
                    "defaultOption" => array("Select the Year" => null),
                    "dataStore" => $this->dataStore("yr_list"),
                    "dataBind" => array(
                        "text" => "yearinfo",
                        "value" => "yearinfo",
                    ),
                    "attributes" => array(
                        "class" => "form-control",
                    ),
                ));
                ?>
                </div>
                <div class="col-md-4 offset-md-12">
                    <button id="submit"  class="btn btn-primary"><strong>Show Report</strong></button>
                </div>
            </div>    
</div>
<div class="border-top my-3"></div>

<!-- <script src="https://code.jquery.com/jquery-3.1.0.js"></script> -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
    
   /* $('yearinfo').change(function(e){
      // this function runs when a user selects an option from a <select> element
      window.location.href = $("yearinfo option:selected").attr('value');
   }); */
   $(function() {
    if (sessionStorage.getItem('yearinfo')) {
        $("#yearinfo option").eq(sessionStorage.getItem('yearinfo')).prop('selected', true);
    }
    $("#yearinfo").on('change', function() {
        sessionStorage.setItem('yearinfo', $('option:selected', this).index());
    });
});
$yr=$('#yearinfo').val();
$(document).ready(function() {
    $('#submit').click(function() {
        $yr=$('#yearinfo').val();
        //if(window.location.hostname == 'localhost'){
            //alert('111111111');
            window.open('VolumeSalesDrillDown.main.php?yR=' + $('#yearinfo').val(), '_self');
            //}else{
                //window.open('StrategyFinMainCard.php?EXECD=$EXECD&YR=$Yrdt', '_blank');
                //}
                console.log("----> listdestails ---start");
                console.log("YEARINFO:"+$('#yearinfo').val());
                console.log("YR:"+$yr);
                console.log("----> listdestails ---end");  
            });
        });
        
        //alert('0000000000');
        /* window.onload = function() {
            //alert('111111111');
            listdetails();
        } */
        </script>

        <BR/>
        <?php
        /* echo 'View<BR>'.$_GET['yR'];
        echo '<BR>Substring<br>'. substr($_GET['yR'],0,9);
        echo '<BR>head<br>'. substr($_GET['yR'],10);
        */
        if(!empty($_GET['yR'])){
            if($_GET['yR'] != null){
                $yr1=$_GET['yR'];
                global $yR_1,$yR_2,$yR_3;
                $yR_1=substr($yr1,2,2);
                $yR_2=substr($yr1,7,2);
                $yR_3 ='VOLSALE_'."".$yR_1."".$yR_2." ";
                //$yR_3 =$yR_1.$yR_2;

                /*echo '<br>'.$yR_1;
                echo '<br>'.$yR_2;
                echo '<br>'.$yR_3;*/
                //echo 'View<BR>'.$_GET['yR'];
                /* echo '<BR>Substring<br>'. substr($_GET['yR'],0,9);
                echo '<BR>head<br>'. substr($_GET['yR'],10); */
                ?>
                <div class="report-content">
                <div class="text-center">
                <h3>Volume Sales Report from<?php print ' '. substr($_GET['yR'],10);?></h3>
                <p class="lead">
                Please click on the column of chart/table to go further down on details.
                </p>
                </div>
                
                <style>
                .cssHeader
                {
                    font-size: 12px;
                    text-align:center;
                }
                .cssItem
                {
                    font-size: 12px;
                }
                .cssIFooter
                {
                    font-size: 12px;
                    text-align:right;
                }
                .cssTd
                {
                    text-align:left;
                }
                .cssTdw
                {
                    text-align:right;
                    background-color:#FAFAFA !important;
                }
                </style>
                
                
                <?php
                DrillDown::create(array(
                    "name"=>"saleDrillDown",
                    "title"=>"Analyze Geographical Wise Volume Sale",
                    "levels"=>array(
                        array(
                            "title"=>"All Zones",
                            "content"=>function($params,$scope)
                            {
                                ColumnChart::create(array(
                                    "dataSource"=>(
                                        $this->src("automaker")->query("
                                        SELECT upper(zone) zone,sum(isnull(INVVOLFORTHEDAY,0))-sum(isnull(STKRTNDAY,0)) netvolday
                                        FROM  " . $GLOBALS["yR_3"] . " where EXECCODE IN (select repcode from HIERARCHY_DET where repcode_rep='999940011') and year='" . substr($_GET['yR'],0,9) . "'  GROUP BY ZONE ORDER BY sum(isnull(INVVOLFORTHEDAY,0))-sum(isnull(STKRTNDAY,0)) DESC
                                        ")
                                    ),
                                    "title"=>"Zone Wise Net Volume Sale",
                                    "columns"=>array(
                                        "zone"=>array(
                                            "type"=>"string",
                                            "label"=>"ZONE",
                                        ),
                                        "netvolday"=>array(
                                            "type"=>"number",
                                            "label"=>"QTY",
                                            "formatValue"=>function($value,$row)
                                            {
                                                return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                            }
                                            )
                                        ),
                                        "clientEvents"=>array(
                                            "itemSelect"=>"function(params){
                                                saleDrillDown.next({zone:params.selectedRow[0]});
                                            }",
                                            )
                                        ));
                                    }
                                ),
                                array(
                                    "title"=>function($params,$scope)
                                    {
                                        return "ZONE - ".$params["zone"];
                                    },
                                    "content"=>function($params,$scope)
                                    {
                                        ColumnChart::create(array(
                                            "dataSource"=>(
                                                $this->src("automaker")->query("
                                                SELECT upper(locnm) locnm,sum(isnull(INVVOLFORTHEDAY,0))-sum(isnull(STKRTNDAY,0)) netvolday
                                                from " . $GLOBALS["yR_3"]  . " where zone=:zone and EXECCODE IN (select repcode from HIERARCHY_DET where repcode_rep='999940011') and year='" . substr($_GET['yR'],0,9) . "'  
                                                GROUP BY locnm ORDER BY sum(isnull(INVVOLFORTHEDAY,0))-sum(isnull(STKRTNDAY,0)) DESC
                                                ")
                                                ->params(array(
                                                    ":zone"=>$params["zone"]
                                                    ))
                                                ),
                                                "title"=>"Office Wise Net Volume Sale",
                                                "columns"=>array(
                                                    "locnm"=>array(
                                                        "type"=>"string",
                                                        "label"=>"lOCNM",
                                                    ),
                                                    "netvolday"=>array(
                                                        "type"=>"number",
                                                        "label"=>"Qty",
                                                        "formatValue"=>function($value,$row)
                                                        {
                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                        }
                                                        )
                                                    ),
                                                    "clientEvents"=>array(
                                                        "itemSelect"=>"function(params){
                                                            saleDrillDown.next({locnm:params.selectedRow[0]});
                                                        }",
                                                        )
                                                    ));
                                                }        
                                            ),
                                            array(
                                                "title"=>function($params,$scope)
                                                {
                                                    return "Office - ".$params["locnm"];
                                                },
                                                "content"=>function($params,$scope)
                                                {
                                                    DataTables::create(array(
                                                        "name" => "reportTable",
                                                        "dataSource"=>(
                                                            $this->src("automaker")->query("
                                                            SELECT upper(state) state,sum(isnull(SCHOOLMAPPED,0)) SCHOOLMAPPED,sum(isnull(SCHOOLPLANNED,0)) SCHOOLPLANNED,sum(isnull(TOTUSERSCH,0)) TOTUSERSCH,sum(isnull(SCHOOLVISITSMAPPED,0)) SCHOOLVISITSMAPPED,sum(isnull(SCHOOLVISITSUNMAPPED,0)) SCHOOLVISITSUNMAPPED,
                                                            sum(isnull(SCHOOLPDBMAPPED,0)) SCHOOLPDBMAPPED,sum(isnull(SCHOOLPDBUNMAPPED,0)) SCHOOLPDBUNMAPPED,sum(isnull(OTHERSPDB,0)) OTHERSPDB,sum(isnull(PDBVOL,0)) PDBVOL,sum(isnull(NETAPPRVOL,0)) NETAPPRVOL,
                                                            sum(isnull(MCRTOTCALLS,0)) MCRTOTCALLS,sum(isnull(TOTACTCALLSMAPPED,0)) TOTACTCALLSMAPPED,sum(isnull(TOTACTCALLSUNMAPPED,0)) TOTACTCALLSUNMAPPED,
                                                            sum(isnull(PLANVOL,0)) PLANVOL,sum(isnull(PLNADOPT,0)) PLNADOPT,sum(isnull(INVVOLFORTHEDAY,0)) INVVOLFORTHEDAY,sum(isnull(STKRTNDAY,0)) STKRTNDAY,sum(isnull(STKRTNDAYINV,0)) STKRTNDAYINV,sum(isnull(INVVOLFORTHEDAY,0))-sum(isnull(STKRTNDAY,0)) NETVOLDAY,
                                                            sum(isnull(OINVVOLFORTHEDAY,0)) OINVVOLFORTHEDAY,sum(isnull(OSTKRTNDAY,0)) OSTKRTNDAY,sum(isnull(OSTKRTNDAYINV,0)) OSTKRTNDAYINV,sum(isnull(OINVVOLFORTHEDAY,0))-sum(isnull(OSTKRTNDAY,0)) ONETVOLDAY,sum(isnull(INVVOLFORTHEDAY,0))-sum(isnull(STKRTNDAY,0))+sum(isnull(OINVVOLFORTHEDAY,0))-sum(isnull(OSTKRTNDAY,0)) TNETVOLDAY
                                                            from " . $GLOBALS["yR_3"]  . " where zone=:zone and locnm=:locnm and EXECCODE IN (select repcode from HIERARCHY_DET where repcode_rep='999940011') and year='" . substr($_GET['yR'],0,9) . "'  
                                                            GROUP BY state ORDER BY sum(isnull(INVVOLFORTHEDAY,0))-sum(isnull(STKRTNDAY,0)) DESC
                                                            ")
                                                            ->params(array(
                                                                ":zone"=>$params["zone"],
                                                                ":locnm"=>$params["locnm"],
                                                                ))
                                                            ),
                                                            "plugins" => ["FixedHeader","FixedColumns"],
                                                            "options" => array(
                                                                "colReorder" => true,
                                                                "scrollY" => "500px",
                                                                "scrollX" => true,
                                                                "scrollCollapse" => true,
                                                                "fixedHeader"=>true,
                                                                // "fixedColumns" => array(
                                                                    //     "leftColumns" => 2  
                                                                    // ),
                                                                    "select" => true,
                                                                    "ordering" => false,
                                                                ),
                                                                "responsive"=>true,
                                                                "showFooter"=>true,
                                                                "title"=>"State Wise Net Volume Sale",              
                                                                "columns"=>array(
                                                                    "state"=>array(
                                                                        "type"=>"string",
                                                                        "label"=>"STATE NAME",
                                                                        "footerText"=>"<b>Total:</b>",
                                                                    ),
                                                                    "SCHOOLMAPPED"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Schools Mapped",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "SCHOOLPLANNED"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Mapped Schools Planned",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            if ($cKey === 'SCHOOLPLANNED')
                                                                            {
                                                                                if ($row["SCHOOLMAPPED"] == 0) {
                                                                                    return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                                } /* else {
                                                                                    $a = ($value*100/$row["SCHOOLMAPPED"]);
                                                                                    $css = indicators3($val = $a, $indicator_array = array(0, 85, 100), $indicator_rating = "normal");
                                                                                    return "<div class='" . $css . "'>" . preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value ) . "</div>";
                                                                                } */
                                                                            }
                                                                            else{
                                                                                return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            }
                                                                        },
                                                                    ),
                                                                    "TOTUSERSCH"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Total User School",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            if ($cKey === 'TOTUSERSCH')
                                                                            {
                                                                                if ($row["SCHOOLPLANNED"] == 0) {
                                                                                    return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                                } /* else {
                                                                                    $a = ($value*100/$row["SCHOOLPLANNED"]);
                                                                                    $css = indicators3($val = $a, $indicator_array = array(0, 85, 100), $indicator_rating = "normal");
                                                                                    return "<div class='" . $css . "'>" . preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value ) . "</div>";
                                                                                } */
                                                                            }
                                                                            else{
                                                                                return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            }
                                                                        },
                                                                    ),
                                                                    "SCHOOLVISITSMAPPED"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Mapped Schools Visited",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "SCHOOLVISITSUNMAPPED"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Un-Mapped Schools Visited",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "MCRTOTCALLS"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Calls Planned",
                                                                        "cssStyle"=>"text-align:right",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "TOTACTCALLSMAPPED"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Mapped School Actual Visits",
                                                                        "cssStyle"=>"text-align:right",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "TOTACTCALLSUNMAPPED"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Un-Mapped School Actual Visits",
                                                                        "cssStyle"=>"text-align:right",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "SCHOOLPDBMAPPED"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"PDB (Mapped Schools)",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "SCHOOLPDBUNMAPPED"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"PDB (Un-Mapped Schools)",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "OTHERSPDB"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"PDB TO OTHERS",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "PDBVOL"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Total PDB",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "NETAPPRVOL"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Approval Pending",
                                                                        "cssStyle"=>"text-align:right",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "PLANVOL"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Planned Title Volume",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "PLNADOPT"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Planned Title Adopted",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "INVVOLFORTHEDAY"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Invoiced Volume Sale",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "STKRTNDAY"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Stock Returned Volume",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            if ($cKey === 'STKRTNDAY')
                                                                            {
                                                                                if ($row["INVVOLFORTHEDAY"] == 0) {
                                                                                    return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                                } /* else {
                                                                                    $a = ($value*100/$row["INVVOLFORTHEDAY"]);
                                                                                    $css = indicators3($val = $a, $indicator_array = array(0, 10, 20), $indicator_rating = "reverse");
                                                                                    return "<div class='" . $css . "'>" . preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value ) . "</div>";
                                                                                } */
                                                                            }
                                                                            else{
                                                                                return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            }
                                                                        },
                                                                    ),
                                                                    "NETVOLDAY"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Net Volume Sale",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "OINVVOLFORTHEDAY"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Invoiced Volume Sale (Other Branch)",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "OSTKRTNDAY"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Stock Returned Volume (Other Branch)",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "ONETVOLDAY"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Net Volume Sale (Other Branch)",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "TNETVOLDAY"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Total Net Volume Sale",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                    "STKRTNDAYINV"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Stock Returned For The Business Year Invoices",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            if ($cKey === 'STKRTNDAYINV')
                                                                            {
                                                                                if ($row["INVVOLFORTHEDAY"] == 0) {
                                                                                    return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                                } /* else {
                                                                                    $a = ($value*100/$row["INVVOLFORTHEDAY"]);
                                                                                    $css = indicators3($val = $a, $indicator_array = array(0, 10, 20), $indicator_rating = "reverse");
                                                                                    return "<div class='" . $css . "'>" . preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value ) . "</div>";
                                                                                } */
                                                                            }
                                                                            else{
                                                                                return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            }
                                                                        },
                                                                    ),
                                                                    "OSTKRTNDAYINV"=>array(
                                                                        "type"=>"number",
                                                                        "label"=>"Stock Returned For The Business Year Invoices (Other Branch)",
                                                                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                        "footer"=>"sum",
                                                                        "footerText"=>"<b>@value</b>",
                                                                        "formatValue"=>function($value,$row, $cKey)
                                                                        {
                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                            
                                                                        },
                                                                    ),
                                                                ),
                                                                "cssClass"=>array(
                                                                    "table"=>"table table-hover",
                                                                    "id"=>"rtable",
                                                                    "th"=>"cssHeader",
                                                                    "tr"=>"cssItem",
                                                                    "tf"=>"cssIFooter",
                                                                    "td"=>function($row,$colName)
                                                                    {
                                                                        if ($colName=="state")
                                                                        {
                                                                            return "cssTd";
                                                                        }
                                                                        else if ($colName=="SCHOOLMAPPED" or $colName=="SCHOOLPLANNED" or $colName=="TOTUSERSCH" or $colName=="SCHOOLVISITSMAPPED" or $colName=="SCHOOLVISITSUNMAPPED" or 
                                                                        $colName=="SCHOOLPDBMAPPED" or $colName=="SCHOOLPDBUNMAPPED" or $colName=="OTHERSPDB" or $colName=="PDBVOL" or $colName=="PLANVOL" or $colName=="PLNADOPT" or $colName=="STKRTNDAYINV" or $colName=="OSTKRTNDAYINV")
                                                                        {
                                                                            return "cssTdw";
                                                                        }
                                                                        else
                                                                        {
                                                                            return "text-right";
                                                                        }
                                                                    },
                                                                ),
                                                                "clientEvents"=>array(
                                                                    "select"=>"function(e,dt,type,indexes){
                                                                        var data = dt.rows(indexes).data()[0];
                                                                        console.log(data);
                                                                        var Stnm=data[0];
                                                                        console.log(Stnm);
                                                                        saleDrillDown.next({state:Stnm});
                                                                    }",
                                                                    )
                                                                ));
                                                            }        
                                                        ),
                                                        array(
                                                            "title"=>function($params,$scope)
                                                            {
                                                                return "State - ".$params["state"];
                                                            },
                                                            "content"=>function($params,$scope)
                                                            {
                                                                DataTables::create(array(
                                                                    "name" => "reportTable1",
                                                                    "dataSource"=>(
                                                                        $this->src("automaker")->query("
                                                                        SELECT upper(distt) distt,sum(isnull(SCHOOLMAPPED,0)) SCHOOLMAPPED,sum(isnull(SCHOOLPLANNED,0)) SCHOOLPLANNED,sum(isnull(TOTUSERSCH,0)) TOTUSERSCH,sum(isnull(SCHOOLVISITSMAPPED,0)) SCHOOLVISITSMAPPED,sum(isnull(SCHOOLVISITSUNMAPPED,0)) SCHOOLVISITSUNMAPPED,
                                                                        sum(isnull(SCHOOLPDBMAPPED,0)) SCHOOLPDBMAPPED,sum(isnull(SCHOOLPDBUNMAPPED,0)) SCHOOLPDBUNMAPPED,sum(isnull(OTHERSPDB,0)) OTHERSPDB,sum(isnull(PDBVOL,0)) PDBVOL,sum(isnull(NETAPPRVOL,0)) NETAPPRVOL,
                                                                        sum(isnull(MCRTOTCALLS,0)) MCRTOTCALLS,sum(isnull(TOTACTCALLSMAPPED,0)) TOTACTCALLSMAPPED,sum(isnull(TOTACTCALLSUNMAPPED,0)) TOTACTCALLSUNMAPPED,
                                                                        sum(isnull(PLANVOL,0)) PLANVOL,sum(isnull(PLNADOPT,0)) PLNADOPT,sum(isnull(INVVOLFORTHEDAY,0)) INVVOLFORTHEDAY,sum(isnull(STKRTNDAY,0)) STKRTNDAY,sum(isnull(STKRTNDAYINV,0)) STKRTNDAYINV,sum(isnull(INVVOLFORTHEDAY,0))-sum(isnull(STKRTNDAY,0)) NETVOLDAY,
                                                                        sum(isnull(OINVVOLFORTHEDAY,0)) OINVVOLFORTHEDAY,sum(isnull(OSTKRTNDAY,0)) OSTKRTNDAY,sum(isnull(OSTKRTNDAYINV,0)) OSTKRTNDAYINV,sum(isnull(OINVVOLFORTHEDAY,0))-sum(isnull(OSTKRTNDAY,0)) ONETVOLDAY,sum(isnull(INVVOLFORTHEDAY,0))-sum(isnull(STKRTNDAY,0))+sum(isnull(OINVVOLFORTHEDAY,0))-sum(isnull(OSTKRTNDAY,0)) TNETVOLDAY
                                                                        from " . $GLOBALS["yR_3"]  . " where zone=:zone and locnm=:locnm and state=:state and EXECCODE IN (select repcode from HIERARCHY_DET where repcode_rep='999940011') and year='" . substr($_GET['yR'],0,9) . "'  
                                                                        GROUP BY distt ORDER BY sum(isnull(INVVOLFORTHEDAY,0))-sum(isnull(STKRTNDAY,0)) DESC
                                                                        ")
                                                                        ->params(array(
                                                                            ":zone"=>$params["zone"],
                                                                            ":locnm"=>$params["locnm"],
                                                                            ":state"=>$params["state"],
                                                                            ))
                                                                        ),
                                                                        "plugins" => ["FixedHeader"],
                                                                        "options" => array(
                                                                            "colReorder" => true,
                                                                            "scrollY" => "500px",
                                                                            "scrollX" => true,
                                                                            "scrollCollapse" => true,
                                                                            "fixedHeader"=>true,
                                                                            // "fixedColumns" => array(
                                                                                //     "leftColumns" => 1  
                                                                                // ),
                                                                                "select" => true,
                                                                                "ordering" => false,
                                                                            ),
                                                                            "responsive"=>true,
                                                                            "showFooter"=>true,  
                                                                            "title"=>"District Wise Net Volume Sale",              
                                                                            "columns"=>array(
                                                                                "distt"=>array(
                                                                                    "type"=>"string",
                                                                                    "label"=>"DISTRICT NAME",
                                                                                    "footerText"=>"<b>Total:</b>",
                                                                                ),
                                                                                "SCHOOLMAPPED"=>array(
                                                                                    "type"=>"number",
                                                                                    "label"=>"Schools Mapped",
                                                                                    "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                                    "footer"=>"sum",
                                                                                    "footerText"=>"<b>@value</b>",
                                                                                    "formatValue"=>function($value,$row, $cKey)
                                                                                    {
                                                                                        return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                                        
                                                                                    },
                                                                                ),
                                                                                "SCHOOLPLANNED"=>array(
                                                                                    "type"=>"number",
                                                                                    "label"=>"Mapped Schools Planned",
                                                                                    "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                                    "footer"=>"sum",
                                                                                    "footerText"=>"<b>@value</b>",
                                                                                    "formatValue"=>function($value,$row, $cKey)
                                                                                    {
                                                                                        if ($cKey === 'SCHOOLPLANNED')
                                                                                        {
                                                                                            if ($row["SCHOOLMAPPED"] == 0) {
                                                                                                return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                                            } /* else {
                                                                                                $a = ($value*100/$row["SCHOOLMAPPED"]);
                                                                                                $css = indicators3($val = $a, $indicator_array = array(0, 85, 100), $indicator_rating = "normal");
                                                                                                return "<div class='" . $css . "'>" . preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value ) . "</div>";
                                                                                            } */
                                                                                        }
                                                                                        else{
                                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                                        }
                                                                                    },
                                                                                ),
                                                                                "TOTUSERSCH"=>array(
                                                                                    "type"=>"number",
                                                                                    "label"=>"Total User School",
                                                                                    "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                                                                                    "footer"=>"sum",
                                                                                    "footerText"=>"<b>@value</b>",
                                                                                    "formatValue"=>function($value,$row, $cKey)
                                                                                    {
                                                                                        if ($cKey === 'TOTUSERSCH')
                                                                                        {
                                                                                            if ($row["SCHOOLPLANNED"] == 0) {
                                                                                                return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                                            } /* else {
                                                                                                $a = ($value*100/$row["SCHOOLPLANNED"]);
                                                                                                $css = indicators3($val = $a, $indicator_array = array(0, 85, 100), $indicator_rating = "normal");
                                                                                                return "<div class='" . $css . "'>" . preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value ) . "</div>";
                                                                                            } */
                                                                                        }
                                                                                        else{
                                                                                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );
                                                                                        }
                                                                             
Sebastian Morales commented on Nov 10

I can see that you commented out options' fixedColumns. What happens if you set the following options:

    "options" => array(
        "scrollY" => "300px",
        "scrollX" => true,
        "scrollCollapse" => true,
        "paging" => false,
        "fixedColumns" => array(
            "leftColumns" => 1
        )
    ), 

Pls post screenshots if possible. Tks,

Lalitha commented on Nov 10

Lalitha commented on Nov 17

Hi Team, Any update on this...

Sebastian Morales commented on Nov 17

Would prefer you state the exact issue instead of guessing from screenshots but is header overlapping your problem? If so does removing "FixedHeader" plugin change it?

Lalitha commented on Nov 18

no removing fixed header is not solving my issue, I need first column to freeze it is over lapping and also when i am clicking on the number it is not going further internally.

Lalitha commented on Nov 30

any update?

Sebastian Morales commented 7 days ago

Pls try a standalone report, no framework, no other js or css files, with DataTables' fixed columns and see if this issue remains. If it does, email the report code to us at support@koolreport.com / support@koolphp.net. If it doesn't there might have been conflict between fixed column plugin with some of your js/css in your project.

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

DataGrid