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);
}
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?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.