I have been following the official tutorial for ag-grid and I've reached a point where I need to manipulate information related to selected checkboxes. However, the documentation lacks detail on how the code actually functions. It might be understandable since it's not their responsibility to provide in-depth explanations. But as someone with limited experience working with Angular technology, I find it challenging to truly grasp the workings of the code!
The html file instructs me to add the following:
<button (click)="getSelectedRows()">Get Selected Rows</button>
And in app.component.ts, I need to include this:
getSelectedRows() {
const selectedNodes = this.agGrid.api.getSelectedNodes();
const selectedData = selectedNodes.map(node => node.data);
const selectedDataStringPresentation = selectedData.map( node => node.make + ' ' + node.model).join(', ');
alert('Selected nodes: ${selectedDataStringPresentation}');
}
If there is someone who can explain what exactly the typescript code is doing, that would be greatly appreciated. Thank you!