<kendo-grid *ngIf="module"
[kendoGridBinding]="module.permissions"
kendoGridSelectBy="id"
[pageSize]="10"
[pageable]="true"
[sortable]="true"
(edit)="editPermissionHandler($event)"
(cancel)="cancelPermissionHandler($event)"
(save)="savePermissionHandler($event)"
(add)="addPermissionHandler($event)"
(remove)="removePermissionHandler($event)">
<ng-template kendoGridToolbarTemplate>
<button kendoGridAddCommand>Add new</button>
</ng-template>
<kendo-grid-column field="id" title="id" hidden="true"></kendo-grid-column>
<kendo-grid-column field="code" title="Code" [width]="180"></kendo-grid-column>
<kendo-grid-column field="description" title="Description"></kendo-grid-column>
<kendo-grid-command-column title="" [width]="220">
<ng-template kendoGridCellTemplate let-isNew="isNew">
<button kendoGridEditCommand [primary]="true">Edit</button>
<button kendoGridRemoveCommand>Remove</button>
<button kendoGridSaveCommand [disabled]="formGroup?.invalid">
{{ isNew ? "Add" : "Update" }}
</button>
<button kendoGridCancelCommand>
{{ isNew ? "Discard changes" : "Cancel" }}
</button>
</ng-template>
</kendo-grid-command-column>
</kendo-grid>
this is how I delete an item:
let indexToDel = this.module.permissions.findIndex(p => p.id == perm.id);
this.module.permissions.splice(indexToDel, 1)
//way to avoid that?
this.module.permissions = this.module.permissions.slice();
Can we avoid the last line to force the update?
Thanks
I just had the same problem a couple of weeks ago - I could not find a better way to do this. AFAIK it even states that you need to do this in the documentation - just did a quick search so I could be mistaken!