From 9dcb7629ae125d9b289e39c0b97e3ec5b82522f1 Mon Sep 17 00:00:00 2001 From: Severino Date: Thu, 6 Nov 2025 12:05:08 +0100 Subject: [PATCH] Added unique key to table rows. --- app/Http/Controllers/EntityController.php | 11 +++++++++++ resources/js/components/attribute/Tabular.vue | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/EntityController.php b/app/Http/Controllers/EntityController.php index c4cf6cbbc..7ce64d1fe 100644 --- a/app/Http/Controllers/EntityController.php +++ b/app/Http/Controllers/EntityController.php @@ -233,6 +233,17 @@ public function getData($id, $aid = null) { } $a->name = $names; break; + case 'table': + // Adds a unique key for the request by using the timestamp and the row number. + $rows = json_decode($a->json_val); + for($i = 0; $i < count($rows); $i++) { + $newRow = $rows[$i]; + + $newRow->index = time() . "-" . ($i + 1); + $rows[$i] = $newRow; + } + $a->json_val = json_encode($rows); + break; default: break; } diff --git a/resources/js/components/attribute/Tabular.vue b/resources/js/components/attribute/Tabular.vue index 840ff1527..46cba881b 100644 --- a/resources/js/components/attribute/Tabular.vue +++ b/resources/js/components/attribute/Tabular.vue @@ -38,7 +38,7 @@