irossimoline/angular4-material-table

How to create a method in component of row.confirmEditCreate()

Closed this issue · 2 comments

.html
<button *ngIf="row.editing" mat-icon-button color="primary" focusable="false" (click)="row.confirmEditCreate()">

.component.ts
how can i call this method
confirmEditCreate(){
//It gives an error
}
By calling this method i will save data in to the database.

@irossimoline Please help

Hi @harshthakur92,

In that case you must call the method with the row as a parameter, as follows:

<button *ngIf="row.editing" mat-icon-button color="primary" focusable="false" (click)="row.confirmEditCreate()">
confirmEditCreate(row: TableElement){
  // Do whatever you need before
  // calling the row method.
  const result = row.confirmEditCreate();
  // You also can use the result 
  // of the operation (boolean).
}

Hope it helps, if you have any other doubt please reach me out.

As the answer seems to fix the issue, I'll close it.

If you have additional questions please feel free to open a new issue.

Regards!