Hello,
I am creating an Ignite UI Grid in Angular application. I need to protect(make non-editable) some specific cells,is there a way to make some cells read-only ?Thank you in advance,Daniel
Hello Daniel,
After investigating this further, I determined that cells are not editable by default. However if editable=”true” is added to the column tag, every cell in the column is editable. Your request could be achieved if a method is bound to the onCellEditEnter event:
<igx-grid #workDataGrid id="workDataGrid" [data]="data1" [height]="'480px'" [width]="'640px'" [autoGenerate]="false" [primaryKey]="'ID'" (onCellEditEnter)="editing($event)" >
In this method if the clicked cell is in the collection of cells, which should not be editable, the event could be canceled:
public editing(evt){
this.cells.forEach(x=>{
if(evt.cellID.rowID === x.rowID && evt.cellID.columnID === x.columnID){
evt.cancel = true;
}
});
I have prepared a sample demonstrating the described behavior.
Please let me know if you need additional information regarding this matter.
Regards,
Monika Kirkova,
Infragistics
Thank u, I have already solved it, but with using conditions in template,so your example helped to make less lines of code.
I am glad that you were able to solve your issue.
Thank you for using Infragistics components.