lai32290/TableHeadFixer

Issue with colspan

Opened this issue · 1 comments

I have a table with this layout (5 fixed columns).

<tr>
   <th colspan='3'>X</th>
   <th id='cal_check_row_all'></th> 
   <th id='cal_check_row_none'></th> 
<tr>

When applying the plugin, the generated css is not homogenous for all the columns (in the same order the above 3 th):

style="position: relative; z-index: 1; top: 0px; left: 0px; background-color: rgb(255, 255, 255);"
style="position: relative; top: 0px; background-color: white;"   // no z-index here!!!
style="position: relative; z-index: 1; top: 0px; left: 0px; background-color: rgb(255, 255, 255);"

When scrolling the table, the 2nd *_th *_go to the left (it not stays in place) bellow the first one.
Alter adding a z-index: 1to it, it goes to the left but above the left th with the colspan.

If the colspan is removed and replaced with <th>a</th><th>b</th><th>c</th> all works fine

jqjk commented

I overwritten solverLeftColspan function as described below,then worked fine for me.
I respect this wonderful plugin.

		function solverLeftColspan(row, action) {
			var fixColumn = settings.left;
			var sum = 0;
			for(var i=1;i<=fixColumn && sum<=fixColumn;++i) {
				var cell = $(row).find("> *:nth-child(" + i + ")");
				var colspan = cell.prop("colspan");
				if (cell.cellPos().left < fixColumn) {
					action(cell);
				}
				sum += colspan;
			}
		}