From fb6745fd31943aeaf3c7f0736392d65527306173 Mon Sep 17 00:00:00 2001 From: candifloss Date: Sun, 23 Feb 2025 02:25:55 +0530 Subject: [PATCH] Updated edited_csv.js --- static/edited_csv.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/static/edited_csv.js b/static/edited_csv.js index 36959f3..b1277a7 100644 --- a/static/edited_csv.js +++ b/static/edited_csv.js @@ -1,8 +1,10 @@ function collectEditedData(event) { + // Extract headers (attribute names) from the table const headers = [...document.querySelectorAll('.table-new-assets thead th')].map(th => th.dataset.attrib); const rows = document.querySelectorAll('.table-new-assets tbody tr'); const assets = []; + // Iterate through rows and collect data rows.forEach(row => { const cells = row.querySelectorAll('td'); let asset = {}; @@ -10,12 +12,14 @@ function collectEditedData(event) { assets.push(asset); }); + // Create a hidden input field to store the collected data const input = document.createElement('input'); input.type = 'hidden'; input.name = 'assets'; input.value = JSON.stringify(assets); document.querySelector('form').appendChild(input); + // Submit the form event.target.submit(); return true; -} +} \ No newline at end of file