KoolReport's Forum

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

DataTables and custom tooltip per column #1490

Open paulo opened this topic on on Jun 18, 2020 - 2 comments

paulo commented on Jun 18, 2020

Hi, I ma trying to add an explanation/description to the columns using a tooltip. For instance, "StaffAmount" => array(

            "label" => "StaffAmount",
            "cssStyle" => "text-align:right",
            "type" => "number",
            "decimals" => 2,
            "footer" => "sum",
            "tooltip"=>function($row){
                return "Something for tooltip";
            }

        ),

Label is stall amount, tooltip would describe how it gets calculated. Is this something I can do with the DataTable ? If not per row, can I do this on the header of the table somehow ?

thanks

David Winterburn commented on Jun 19, 2020

Perhaps a "title" attribute could help in your case:

DataTables::create(array(
    ...
    "attributes" => [
        "td" => function($row, $colKey, $colMeta) {
            if ($colKey === "StaffAmount") return [
                "title" => "Something for tooltip"
            ];
        }
    ],
    ... 
));

Please try this and let us know if it meets your requirement. Thanks!

paulo commented on Jun 23, 2020

thank you very much. It worked!

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