How do I mock data to be chosen in PrimeNG's datatable?
@Component({
selector: 'p-dataTable',
template: `...`
})
class MockDataTableComponent {
@Input() value;
@Input() selection;
@Output() selectionChange = new EventEmitter();
click( rows: number) {
this.selection = rows;
return this.selection;
}
}
@Component({
selector: 'data-table',
template: `<p-dataTable #datatable></p-dataTable>`
})
class MyTableComponent {
@ViewChild('datatable') datatable;
}
How do I manually set a values to the mocked selection in PrimeNG? I want to assign a value to selection like
this.selection[0]['name'] = "John Doe";
this.selection[0]['age'] = 30;
How do I do this?