Posted 19 November 2018, 1:44 pm EST
In Angular 6, we’re trying to add a ‘delete’ button to each row which, on click, deletes that row. We would also like to disable the use of the ‘delete’ key – to encourage use of these delete buttons, if possible.
Given my template below - could you provide me with some typescript which shows how to accomplish this?
<wj-flex-grid #m_grid [keyActionTab]="'CycleOut'" [allowAddNew]="true" [itemsSource]="m_collectionView" (initialized)="initGrid(sender, event)"
<wj-flex-grid-column [header]="'userName'" [binding]="'userName'" [width]="175" [visible]="true"></wj-flex-grid-column>
<wj-flex-grid-column [header]="'firstName'" [binding]="'firstName'" [width]="175" [visible]="true"></wj-flex-grid-column>
<!-- my custom column: -->
<wj-flex-grid-column [header]="'delete'" [width]="130" [visible]="true" format="string">
<ng-template wjFlexGridCellTemplate [cellType]="'Cell'" let-cell="cell">
<button class="btn-primary" id="user-delete" (click)="deleteRow()">Delete</button>
</ng-template>
</wj-flex-grid-column>
</wj-flex-grid>