Updated edited_csv.js
This commit is contained in:
parent
8c4ae8dd88
commit
fb6745fd31
@ -1,8 +1,10 @@
|
|||||||
function collectEditedData(event) {
|
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 headers = [...document.querySelectorAll('.table-new-assets thead th')].map(th => th.dataset.attrib);
|
||||||
const rows = document.querySelectorAll('.table-new-assets tbody tr');
|
const rows = document.querySelectorAll('.table-new-assets tbody tr');
|
||||||
const assets = [];
|
const assets = [];
|
||||||
|
|
||||||
|
// Iterate through rows and collect data
|
||||||
rows.forEach(row => {
|
rows.forEach(row => {
|
||||||
const cells = row.querySelectorAll('td');
|
const cells = row.querySelectorAll('td');
|
||||||
let asset = {};
|
let asset = {};
|
||||||
@ -10,12 +12,14 @@ function collectEditedData(event) {
|
|||||||
assets.push(asset);
|
assets.push(asset);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Create a hidden input field to store the collected data
|
||||||
const input = document.createElement('input');
|
const input = document.createElement('input');
|
||||||
input.type = 'hidden';
|
input.type = 'hidden';
|
||||||
input.name = 'assets';
|
input.name = 'assets';
|
||||||
input.value = JSON.stringify(assets);
|
input.value = JSON.stringify(assets);
|
||||||
document.querySelector('form').appendChild(input);
|
document.querySelector('form').appendChild(input);
|
||||||
|
|
||||||
|
// Submit the form
|
||||||
event.target.submit();
|
event.target.submit();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user