mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-30 05:24:28 +02:00
Use native json_encode to convert treeView objects to JSON.
This should improve the performance.
This commit is contained in:
parent
fbcfc1f2a8
commit
811dca691b
4 changed files with 60 additions and 11 deletions
|
@ -21,7 +21,7 @@
|
|||
|
||||
namespace App\Helpers\Trees;
|
||||
|
||||
class TreeViewNodeState
|
||||
class TreeViewNodeState implements \JsonSerializable
|
||||
{
|
||||
/** @var bool|null */
|
||||
protected $checked = null;
|
||||
|
@ -73,4 +73,25 @@ class TreeViewNodeState
|
|||
{
|
||||
$this->selected = $selected;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
$ret = [];
|
||||
if ($this->selected !== null) {
|
||||
$ret['selected'] = $this->selected;
|
||||
}
|
||||
|
||||
if($this->disabled !== null) {
|
||||
$ret['disabled'] = $this->disabled;
|
||||
}
|
||||
|
||||
if($this->expanded !== null) {
|
||||
$ret['expanded'] = $this->expanded;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue