ce icon indicating copy to clipboard operation
ce copied to clipboard

Stripes messed up upon sorting.

Open lyassa opened this issue 6 years ago • 3 comments

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';
		        }
}

lyassa avatar Dec 04 '19 15:12 lyassa

Try that:

updateTable: function(instance, cell, col, row, val, label, cellName) {
			 if (row % 2) {
		            cell.style.backgroundColor = '#edf3ff';
		        } else {
                            cell.style.backgroundColor = '#ffffff';
                        }
}

pphod avatar Dec 04 '19 15:12 pphod

May I suggest adding a table attribute as follows:

...
"stripes": ['#edf3ff', '#ffffff'],
...

lyassa avatar Dec 04 '19 16:12 lyassa

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,

pphod avatar Dec 07 '19 10:12 pphod