Posted 1 September 2021, 2:00 am EST
Hello,
For delete users, I have updated the method accordingly. Please refer to the code snippet below:
deleteUser() {
const view = this.grid.collectionView as wjcCore.CollectionView;
let data = this.grid.collectionView.sourceCollection.filter((item) => {
if(this.grid.collectionView.filter){
return this.grid.collectionView.filter(item)
}
return true;
})
for (let i = view.sourceCollection.length - 1; i >= 0; i--) {
let flag = false;
if(data.length !== view.sourceCollection.length){
for (let j = 0; j < data.length; j++) {
if(JSON.stringify(data[j]) == JSON.stringify(this.grid.collectionView.sourceCollection[i])){
this.deleteUserSub(view,this.grid,flag,i)
}
}
}else{
this.deleteUserSub(view,this.grid,flag,i)
}
//un-checking the selector checkboxes
view.sourceCollection[i].sel = false;
if(this.grid?.rows[i]){
this.grid.rows[i].isSelected = false;
}
}
this.grid.invalidate();
}
deleteUserSub(view,grid,flag,i){
if (view.sourceCollection[i].sel) {
// save className in dataItem itself
view.sourceCollection[i]._cssClass = this.cssClassDelete;
flag = true;
}
if (flag && view.sourceCollection[i].id === 1000) {
view.remove(view.sourceCollection[i]);
}
}
You can also use this code snippet for your different page size samples. You may also refer to the sample link below demonstrating the same:
https://stackblitz.com/edit/angular-faoxhk?file=src/app/app.component.ts
Regards