For some reason, through the loop, the grid-area property is set several times and it turns out to be: grid-area: sales_twin_1 / sales_twin_1 / sales_twin_1 / sales_twin_1; (and so on with each element from the loop)
But the border is placed correctly and correctly (i.e. only 1 time) How can I make it so that the grid-area is set only once and looks like: grid-area: sales_twin_1?
Here is my script:
for(let i = 0; i<countToPaste; i++){
tech++;
console.log(`tech: ${tech}`)
tableArticles.forEach((item, index) => {
const dataId = item.getAttribute('data-id');
const tableArticleClone = item.cloneNode(true);
if(currentZ!=1){
tableArticleClone.setAttribute('data-id', `${dataId}_twin_${currentZ-tech}`);
tableArticleClone.classList.add('twin', `${dataId}_twin_${currentZ-tech}`);
tableArticleClone.style.border = '1px solid red';
tableArticleClone.style.gridArea =`${dataId}_twin_${currentZ-tech}`;
table.prepend(tableArticleClone);
}
});
}
Aucun commentaire:
Enregistrer un commentaire