I want alternate row of spreadsheet in different color and I can not overwrite webix css classes directly because I do validation for spreadsheet and after validation I will going to change some cells background color. So, How can I change alternate row color of spreadsheet using addStyle and setStyle methods.
Please reply as soon as possible and I am using webix 5.3 version
Hello @pratikshadatir1,
You can set it to the column via setRangeStyle()
.
Check this snippet:
https://snippet.webix.com/mb6eswro
@annazankevich That is Ok. But, I want same functionality after deleting row in spreadsheet. After deleting row, again spreadsheet should have alternate row css. If I again do same code on after delete, it will not get applied.
/Used for applying alternate css in spreadsheet./
var style =ss.addStyle({
“background”: “#b3ffd9”
});
ss.setRangeStyle(“A2:P2”,style);
ss.setRangeStyle(“A4:P4”,style);
ss.refresh();
@pratikshadatir,
As a solution, you can use the inner onCommand
event handler to check if row was removed and use eachRow
method to iterate through all rows and set a style for a range of cells.
Please take a look at the example: https://snippet.webix.com/orgeeqhj