“I’m utilizing the hooks provided below to validate and remove rows by selecting the ‘remove row’ option from the context menu. However, despite setting up conditions to restrict row removal based on specific criteria, the removal operation isn’t being restricted as expected when the condition is met.”
this.hot.addHook(“beforeRemoveRow”,(index, amount, physicalRows, [source]) =>{
if(amount>=this.noOfRow){
alert('User is not allowed to remove all rows ')
return;
}
})
this.hot.addHook(“afterRemoveRow”,(index, amount, physicalRows, [source])=>{
this.row_col_add_removal={}
this.row_col_add_removal={‘operation’:‘remove_row’,‘add_index’:null, ‘removal_indexes’:physicalRows,‘tot_cols’:this.noOfColoumn,‘tot_rows’:this.noOfRow}
this.commonService.loadDataInCells({isClicked:true, remove_row:true, amount : amount});
})
Remove row restriction
Hi @rupeshfend
There are some missing variables in the code snippet you sent. Please prepare a code demo where the issue is replicable so I can investigate it and determine what the problem is.