Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
Hi Sergio,
We will add the column name parameters to Table's and DataTables' formatValue function in the next release of KoolReport. In the meantime, you could achieve this by modify the widgets' code a bit. For example, please open the file koolreport/core/src/widgets/koolphp/Table.tpl.php
and replace the following string:
<?php echo Table::formatValue($value, $meta["columns"][$cKey], $row);?>
with:
<?php echo Table::formatValue($value, $meta["columns"][$cKey], $row, $cKey);?>
Then open the file koolreport/core/src/widgets/koolphp/Table.php
and replace:
public static function formatValue($value, $format, $row = null)
{
$formatValue = Utility::get($format, "formatValue", null);
if (is_string($formatValue)) {
eval('$fv="' . str_replace('@value', '$value', $formatValue) . '";');
return $fv;
} else if (is_callable($formatValue)) {
return $formatValue($value, $row);
} else {
return Utility::format($value, $format);
}
}
with:
public static function formatValue($value, $format, $row = null, $cKey)
{
$formatValue = Utility::get($format, "formatValue", null);
if (is_string($formatValue)) {
eval('$fv="' . str_replace('@value', '$value', $formatValue) . '";');
return $fv;
} else if (is_callable($formatValue)) {
return $formatValue($value, $row, $cKey);
} else {
return Utility::format($value, $format);
}
}
Finally change the formatValue function in your report to include $cKey parameter. Let us know if you have any issue. Thanks!
Hey David, thanks for replying. I tried what you suggested, but after i changed them i get this following error :
It seems like its having conflict with this code in Line 43 of Table.tpl.php : $footerValue = Table::formatValue($this->dataStore->$method($cKey), $meta["columns"][$cKey]);
Maybe a new parameter have to be passed in this code as well ?
By the way, i am implementing the new $cKey parameter in this way in the formatValue function :
Let me know what to do for this. Thankyou!
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo