Update table.php

This commit is contained in:
Alessandro Ferro 2022-03-06 15:26:50 +01:00
parent 03e5607f59
commit dbf55c4c5b
1 changed files with 8 additions and 1 deletions

View File

@ -52,7 +52,14 @@
throw new InvalidArgumentException('Parameter cannot be empty.');
$this->dataSource = $dataSource;
// if array of objects provided
if(is_object($this->dataSource[0]))
$this->columnCaptions = array_keys(get_object_vars($this->dataSource[0]));
// if array of arrays provided
else
$this->columnCaptions = array_keys($this->dataSource[0]);
}
function setCustomCaptions(Array $captions){