0

I'm new to angular and using angular smart-table. What i need is adding validation that no two rows can be similar???? and also adding data below at the bottom of table instead of the default way which is to add row at the top of the table??

1 Answers1

0

I have never used ng2-smart-table, but could you do some pre-processing where you check each value and remove it if it is a duplicate?

for(let i = 0; i < data.length; i++) {
  for(let j = i+1; j < data.length; j++) {
    if(data[i] === data[j]) {
      data.splice(j, 0);
    }
  }
}

as for adding data to the end, could you do something like this instead of letting the table handle it?

addRow(row) {
  data.push(row);
}
rhavelka
  • 2,283
  • 3
  • 22
  • 36