Skip to content

Commit

Permalink
minor demo improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Feb 17, 2024
1 parent 2f729ea commit 4353e14
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions demos/collection/multitable.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function setModel(Model $model, array $route = []): void
$table = Table::addTo($this->addColumn(), ['header' => false, 'class.very basic selectable' => true])->setStyle('cursor', 'pointer');
$table->setModel($model, [$model->titleField]);

$selections = $this->explodeSelectionValue($this->getApp()->tryGetRequestQueryParam($this->name) ?? '');
$selectionIds = $this->explodeSelectionValue($this->getApp()->tryGetRequestQueryParam($this->name) ?? '');

$makeJsReloadFx = function (array $path): JsReload {
return new JsReload($this, [$this->name => new JsExpression('[] + []', [
Expand All @@ -60,15 +60,15 @@ public function setModel(Model $model, array $route = []): void
$jsReload = $makeJsReloadFx($path);
$table->on('click', 'tr', $jsReload);

while ($id = array_shift($selections)) {
foreach ($selectionIds as $id) {
$table->js(true)->find('tr[data-id=' . $this->getApp()->uiPersistence->typecastAttributeSaveField($this->model->getField($this->model->idField), $id) . ']')->addClass('active');

$path[] = $this->getApp()->uiPersistence->typecastAttributeSaveField($this->model->getField($this->model->idField), $id);
$pushModel = new $model($model->getPersistence());
$pushModel = $pushModel->load($id);

$ref = array_shift($route);
if (!$route) {
if ($route === []) {
$route[] = $ref; // repeat last route
}

Expand Down

0 comments on commit 4353e14

Please sign in to comment.