0

At the moment I am using the below logic to match row content to the correct column, but it seems to be slow and because of that sometimes rows don't render. Is there a more efficient way to get the same result?

for (let value of values) {      
let row = new Object();
      for (let column of this.columns) {
          row[column.prop] = value.FieldValues.find(
          function(field){
              return field["field_id"] == column.Fieldid}
          );
      }
      rows.push(row);
}
DN0300
  • 864
  • 2
  • 12
  • 27

1 Answers1

0

You can specify a prop property in your column definition, and ngx-datatable will know which field to show in the grid.

this.columns = [{ 
      name: 'column1',
      prop: 'id1'
    }, {
      name: 'column2',
      prop: 'id2'
    } ];
this.row = [
  {id1: 'row-1-value1', id2: 'row-1-value2'},
  {id1: 'row-2-value1', id2: 'row-2-value2'}
]

Is this something you are after?

Sam
  • 640
  • 5
  • 15