ce
ce copied to clipboard
Stripes messed up upon sorting.
I use the code below to create stripes, but then they are messed up as soon as sorting on any of the columns. Is there a better way to create stripes?
updateTable: function(instance, cell, col, row, val, label, cellName) {
if (row % 2) {
cell.style.backgroundColor = '#edf3ff';
}
}
Try that:
updateTable: function(instance, cell, col, row, val, label, cellName) {
if (row % 2) {
cell.style.backgroundColor = '#edf3ff';
} else {
cell.style.backgroundColor = '#ffffff';
}
}
May I suggest adding a table attribute as follows:
...
"stripes": ['#edf3ff', '#ffffff'],
...
Lyassa,
jExcel is just a simple HTML DOM TABLE, so, you can use CSS to do that.
https://www.w3schools.com/howto/howto_css_table_zebra.asp
Regards,