KoolReport's Forum

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

Table and column format from json #2735

Closed Edp Ferrino opened this topic on on Jun 22, 2022 - 2 comments

Edp Ferrino commented on Jun 22, 2022

Hi, I have some data that I see correctly in a table.

				Table::create(array(
    				"dataStore"=>$this->dataStore('mydata'),
                	"showFooter"=>false,
                	"emptyValue" => " ",
    				
    				"cssClass"=>array(
        				"table"=>"table table-hover table-bordered"
    				)
				));     

This table consists of two fields, field1 and field2. I would like to set the column format starting from a json string. Like this string...

[{

"name": "field1",
"label": "MODEL",
"type":"string",
"footerText":"<b>Totale:</b>"

}, {

"name": "field2",
"label":"money",
"type":"number",
"thousandSeparator":".",
"decimalPoint":",",
"decimals":2,
"prefix":"# ",
"footer":"sum",
"footerText":"@value"

}]

How can I do?

Sebastian Morales commented on Jun 23, 2022

You can use json_decode($jsonStr, true) to convert $jsonStr to an array and use that array for your Table's column setting. Let us know if there's any issue. Tks,

Edp Ferrino commented on Jun 23, 2022

Thank you, is very simple

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
None yet

None