Q:

Angular - Material Table, is it possible to edit rows by clicking a button? 

i have mat-table in that i need to edit table.   in table their is edit icon button ,if  i clicked on edit button the first 3 columns should  be editable and need to updated after editing. 
edit should in same inline only not as mat-dialogue box .  if we pressed on edit button name, age, phone-number should be editable .  please help me in this
.html file

        <div class="table-container mat-elevation-z8">
          <mat-table mat-stretch-tabs [dataSource]="dataSource" matSort matSortActive="name" matSortDirection="asc" matSortDisableClear>
           <ng-container matColumnDef="name">
             <mat-header-cell *matHeaderCellDef mat-sort-header >  Name <mat-icon>filter_list</mat-icon> </mat-header-cell>
              <mat-cell *matCellDef="let datalist " > {{datalist.name}} </mat-cell>
           </ng-container>


            <ng-container matColumnDef="description">
              <mat-header-cell *matHeaderCellDef mat-sort-header > Age <mat-icon>filter_list</mat-icon> </mat-header-cell>
              <mat-cell *matCellDef="let datalist" > {{datalist.age}} </mat-cell>
            </ng-container>
              <ng-container matColumnDef="databaseId">
                <mat-header-cell *matHeaderCellDef mat-sort-header >  <mat-icon>filter_list</mat-icon> </mat-header-cell>
                <mat-cell *matCellDef="let datalist" > {{datalist.phonenumber}} </mat-cell>
             </ng-container>

              <ng-container matColumnDef="isActive">
                  <mat-header-cell *matHeaderCellDef  > IsActive/InActive </mat-header-cell>
                  <mat-cell *matCellDef="let datalist" ><mat-slide-toggle color="primary" [checked]="datalist.isActive"></mat-slide-toggle></mat-cell>
              </ng-container>
             
              <ng-container matColumnDef="edit">
                <mat-header-cell *matHeaderCellDef > Edit </mat-header-cell>
                <mat-cell *matCellDef="let row">
                  <button mat-icon-button color="primary" >
                    <mat-icon>edit</mat-icon>
                  </button>
                </mat-cell>
              </ng-container>

              <ng-container matColumnDef="delete">
                <mat-header-cell *matHeaderCellDef > Delete </mat-header-cell>
                <mat-cell *matCellDef="let datalist">
                  <button mat-icon-button color="primary" (click)="clickEvent(datalist,datalist.principalId)"  [ngClass]="{'myClass':datalist.isClicked}">
                    <mat-icon>remove_circle</mat-icon>
                  </button>
                </mat-cell>
              </ng-container>
                
              <mat-header-row *matHeaderRowDef="displayedColumns" ></mat-header-row>
              <mat-row *matRowDef="let row; columns: displayedColumns;" (click)="onRowClicked(datalist)"></mat-row>
          </mat-table>
        </div>

        <div>
         <div class='left'>
           <button class="mat-button menu-button">
              <mat-icon color="primary"> add_to_photos </mat-icon>
              Add Site
           </button>
          </div>
          <div *ngIf="showButtons" class='right'>
            <button mat-button type="button"  class="close-button" (click)="cancel()">
              <mat-icon>block</mat-icon>
             CANCEL
            </button>       
           <button (click)="delete()">Save</button>
          </div> 
        </div>   

    

A:

This answer is not specific to mat-table, but try using PrimeNG for editable tables. 
https://www.primefaces.org/primeng/#/table/edit

