This commit is contained in:
2024-08-07 14:21:00 +03:00
3 changed files with 13 additions and 8 deletions

View File

@ -13,9 +13,14 @@ class ViewJsonTable extends JasonTable
private array $dataJson;
public function __construct($json)
{
$this->beforePrintCell = [];
$this->json = $json;
$this->data = json_decode($this->json, true);
$this->dataJson = $this->data['data'];
$this->beforePrintHook = function () {
};
$this->afterPrintHook = function () {
};
}
public function beginTable(): void
@ -34,7 +39,7 @@ class ViewJsonTable extends JasonTable
{
foreach ($this->data['meta']['rows'] as $key => $row){
if ($this->issetRow($key)){
if ($this->beforePrintCell and $this->dataJson[$key] !== null) {
if ($this->beforePrintCell) {
$this->dataJson[$key] = $this->getCustomCell($key, $this->dataJson[$key]);
}
$this->html .= "<tr><th>" . $row . "</th><td>" . $this->dataJson[$key] . "</td></tr>";