KoolReport's Forum

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

Merge table header? #66

Open zenon opened this topic on on Aug 7, 2017 - 9 comments

zenon commented on Aug 7, 2017

Hi,

How to merger table header, as shown below?

Thanks.

KoolReport commented on Aug 7, 2017

It is not possible currently

zenon commented on Aug 7, 2017

Tried to do the above by combining columns, which is by using CalculatedColumn. Was able to combine the two columns together, but the decimal places(if there is) will run. How to fix this?

Appreciate your help.

KoolReport commented on Aug 7, 2017

Could you please give me more details. I have not understood your issue.

zenon commented on Aug 7, 2017

Hi,

As seen in Table 1, I was able to do so by using ColumnMeta (adding the decimals(2) and suffix(%)). This is great.

However, as merging table header is not possible like Table 2, I tried using CalculatedColumn to combine the two columns (sales and percentage) to one column (item A) as seen in Table 3. Was able to do so, but the decimals and suffix disappear even though i did not remove the ColumnMeta codes, like in Table 1.

How to ensure that the decimals and suffix remain like in Table 1 for Table 3?

Appreciate it. Thanks.

KoolReport commented on Aug 7, 2017

I see your solution, you can do this:

->pipe(new CalculatedColumn(array(
    "itemA"=>array(
        "exp"=>function($data)
        {
            return number_format($data["sales"],2)."  ".number_format($data["percentage"],2)."%";
        },
        "type"=>"string",
    )
)))
zenon commented on Aug 7, 2017

Thanks a lot.

zenon commented on Aug 8, 2017

I managed to do it with the code above, but now I want to sum itemA at the footer (both sales and percentage, after merging the two columns together).

However, there is an error (A non well formed numeric value encountered).

How to fix this?

Appreciate your help.

KoolReport commented on Aug 8, 2017

That's the problem since we merge columns into one so basically footer will not work. I suggest you to do this. We make the border between two column disappear and do not show title for "percentage". Title of "sales" changes to "item A"

Table::create(array(
    "columns"=>array(
        "sales"=>array(
            "label"=>"item A"
        ),
        "percentage"=>array(
            "cssStyle"=>"border-left:none;",
            "label"=>"",
        )
    )
));

By the way, I will send you the updated Table widget which has the cssStyle settings.

zenon commented on Aug 8, 2017

Okay. I will try again. 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

None