Posted 20 March 2018, 10:29 pm EST
Hi,
I am using Flexsheet with Angular 2. I am making some cells not-editable on some conditions, How to change the color of those not-editable cells from itemFormatter.
Thanks,
Sasmita
Forums Home / Wijmo / General Discussion
Posted by: sasmita.swain2014 on 20 March 2018, 10:29 pm EST
Posted 20 March 2018, 10:29 pm EST
Hi,
I am using Flexsheet with Angular 2. I am making some cells not-editable on some conditions, How to change the color of those not-editable cells from itemFormatter.
Thanks,
Sasmita
Posted 21 March 2018, 8:54 pm EST
To do this you need to again check the condition in itemFormatter to see if this is editable and set color afterwards.
ex:-suppose every 3 cell in a column with binding=“country” is non-editable then to style them using item-formatter you need to do something as in the following code snippet
<wj-flex-sheet #flex (initialized)="init(flex)" [itemFormatter]="formatItem" ></wj-flex-sheet>
//formatItem method
formatItem(panel,rowIndex,colIndex,cell){
//check condition for non - editable cell
if((panel.cellType=="Cell")&&(panel.columns[colIndex].binding=="country")&&(rowIndex%3==2)){
cell.style.backgroundColor="red";
}
}
Posted 27 March 2018, 1:42 am EST
Hi Abhishek,
it is working. But when the cell switched from non-editable to editable, then for that particular cell i don’t want any style . I am giving in else condition as cell.style.color=“”; but the style is not removing.
Thanks,
Sasmita
Posted 27 March 2018, 9:29 pm EST
https://stackblitz.com/edit/angular-ihsdxd
Give this a try and let me know if you are still facing issues.