Hello,
In the sample project, I would like to be able to delete rows that contain selected cells. To do this, I have created a button named "Delete selected rows" which retrieves the selected rows and should delete them.
In the example (app.component.ts l.65) I use deleteRecord, but I also tried to use deleteRow with in input "tr Elements".
I don't want to delete rows based on their id because they don't always have one.
I would like to delete it in the cell and batch mode. That way I can click on the cancel button.
Thank you in advance for your answer.
Attachment: test_753f27ef.zip
|
deleteSelectedRows(): void {
let selectedRows = this.grid.getSelectedRowCellIndexes()
let selectedObjects: any[] = [];
selectedRows.forEach(row => {
selectedObjects.push(this.grid.currentViewData[row.rowIndex]);
});
selectedObjects.forEach(selectedObject => {
console.log(selectedObject);
this.grid.editModule.deleteRecord("id", selectedObject);
});
}
|
Thank you for your answer.
I knew that I had to enter a fieldname and its corresponding data. I had explained my problem wrong.
I would like to be able to delete an entity from its index.
Knowing that all the values of my entity are nullable.
For example my grid contains :
{ name: theo, age: 41 },
{ name: lea, age: 69 },
{ name: null, age: 71 },
{ name: antoine, age: null },
{ name: null, age: null }]
I would like to from an index, delete an entity. I would also like the deletion to be done in the code.
The grid is in batch and cell mode.
The user should be able to click on cancel/save to validate or not the modifications.