KoolReport's Forum

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

Drilldown Table, Disable Click on header #1355

Closed PT. Four Best Synergy opened this topic on on Mar 23 - 5 comments

PT. Four Best Synergy commented on Mar 23

I've created drilldown using Table::create. It works, but when i click the header. it take the selected value of the header and continue the drilldown.

for example.

No | month | value

data [ {'1 ', '1', '1000'}, {'2', '2', '3000'}, {'3', '3', '5000'} ]

so,when i click in the data row. it will drilldown to another table with a correct parametes of month( 1 , 2 or 3 ). but i able to click on the header,and it drilldown to another table with string parameters month. how i disable the header so it can not be click and not redirect to another drilldown.

i can do it with javascript. so when the parameters is string, it wont be drilling down. but it's not a good approach. i rather disabled it.

DrillDown::create(array(
        "name"=>"PaymentSalesDrilldown",
        "title"=>"Laporan Data Payment Sales Method",
        "showHeader"=>true,
        "levels"=>array(
            array(
                "title"=>"Payment Sales",
                "content"=>function($params,$scope)
                {
                    Table::create(array(
                        "dataSource"=>(
                            $this->src("honda")->query("
                                SELECT  extract(year from tanggal) as jp, count(id) as total_trx, sum(nilai) as nilai, sum(disc) as disc, sum(revenue) as revenue, (SELECT round((sum(revenue::decimal)/(select sum(revenue) from data_sales_spk)*100),2)) as persen
                                fROM data_sales_spk
                                GROUP BY jp
                                ORDER BY jp")
                            ),
                            "columns"=>array(
                                "jp"=>array(
                                    "type"=>"string",
                                    "label"=>"Tahun"
                                ),
                                "total_trx"=>array(
                                    "label"=>"Total Trx"
                                ),
                                "nilai"=>array(
                                    "type"=>"number",
                                    "label"=>"Nilai Penjualan"
                                ),
                                "disc"=>array(
                                    "type"=>"number",
                                    "label"=>"Nilai Diskon"
                                ),
                                "revenue"=>array(
                                    "type"=>"number",
                                    "label"=>"Nilai Revenue"
                                ),
                                "persen"=>array(
                                    "type"=>"number",
                                    "label"=>"Persen",
                                    "formatValue"=>"@value %",
                                    "decimal"=>2
                                )
                        ),
                        "clientEvents"=>array(
                            "rowClick"=>"function(params){
                                PaymentSalesDrilldown.next({year:params.rowData[0]});
                            }",
                        ),
                        "cssClass"=>array(
                            "table"=>"table table-hover table-tr"
                        )
                    ));
                }
            ),
KoolReport commented on Mar 23

This is considered as a bug, here is the fix: Please go to line 19 of koolreport/core/widgets/koolphp/table/table.js and make change to:

$('#'+this.name+" tbody tr").on('click',function(event){

This will trigger rowClick only for tr inside tbody.

We will apply the fix in next version.

Thank you very much.

PT. Four Best Synergy commented on Mar 24

I dont think my code used table.js file. because i add the code and even empty the table.js file. it not showing any error and still can drilldown the header. this happen in CI.

But in laravel. i can click the header but it just loading and somehow abort the drilldown.

KoolReport commented on Mar 24

Please look for folder "koolreport_assets" in CI, this is the temporary exported resources folder. Remove that folder and run report again.

PT. Four Best Synergy commented on Mar 24

Sorry my bad, i didn't see it. it works now. Thanksss

KoolReport commented on Mar 24

Great!

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

DrillDown