From 23f27e6f34c68177b1e5968e940bb39d139318d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Fri, 10 Aug 2018 20:46:43 +0200 Subject: [PATCH] use control-group for add-rows widget, fix paginator overflowing with hundreds of items --- app/Tables/Changeset.php | 14 ++++- resources/assets/js/components/RowsEditor.vue | 63 ++++++++++--------- 2 files changed, 47 insertions(+), 30 deletions(-) diff --git a/app/Tables/Changeset.php b/app/Tables/Changeset.php index 3c7c948..f6278c9 100644 --- a/app/Tables/Changeset.php +++ b/app/Tables/Changeset.php @@ -619,9 +619,19 @@ class Changeset return $c->cast(null); })->all(); + foreach ($this->newColumns as $k => $obj) { + $cols[] = $c = new Column($obj); + $c->markAsNew(); + + $emptyTpl[$k] = $c->cast(null); + } + $this->newRows = array_filter($this->newRows, function ($r) use ($emptyTpl) { - $emptyTpl['_id'] = $r['_id']; - return $emptyTpl != $r; + foreach ($r as $k => $val) { + if ($k[0] == '_') continue; + if ($val != $emptyTpl[$k]) return true; + } + return false; }); } } diff --git a/resources/assets/js/components/RowsEditor.vue b/resources/assets/js/components/RowsEditor.vue index 8e8515b..5cfe3cc 100644 --- a/resources/assets/js/components/RowsEditor.vue +++ b/resources/assets/js/components/RowsEditor.vue @@ -11,36 +11,43 @@ Rows are identified by row._id, columns by col.id