经测,setGridWidth方法改的并不是第一行的宽度,而是第一行后几行的宽度。所以要加上第一行的宽度。
最后几行代码改的是最后一列的宽度,然而并没有用。滚动条在表格之外。
本地4263行开始
$.each($t.p.colModel, function(i) { if(this.hidden === false && !this.fixed){ cw = this.widthOrg; cw = Math.round(aw*cw/($t.p.tblwidth-brd*vc-gw)); if (cw < 0) { return; } this.width =cw; initwidth += cw; $t.grid.headers[i].width=cw; $t.grid.headers[i].el.style.width = cw + "px"; $($t.grid.hDiv).find(‘.jqg-first-row-header th:eq(‘ + i + ‘)‘).css({width:cw + "px"});//mod by xss 窗口缩放时发现对不齐 if($t.p.footerrow) { $t.grid.footers[i].style.width = cw+"px"; } if(cle) { $t.grid.cols[i].style.width = cw+"px"; } lvc = i; } }); if (!lvc) { return; } cr =0; if (hs) { if(nwidth-gw-(initwidth+brd*vc) !== scw){ cr = nwidth-gw-(initwidth+brd*vc)-scw; } } else if( Math.abs(nwidth-gw-(initwidth+brd*vc)) !== 1) { cr = nwidth-gw-(initwidth+brd*vc); } $t.p.colModel[lvc].width += cr; $t.p.tblwidth = initwidth+cr+brd*vc+gw; if($t.p.tblwidth > nwidth) { var delta = $t.p.tblwidth - parseInt(nwidth,10); $t.p.tblwidth = nwidth; cw = $t.p.colModel[lvc].width = $t.p.colModel[lvc].width-delta; } else { cw= $t.p.colModel[lvc].width; } //mod by xss //$t.grid.headers[lvc].width = cw; //$t.grid.headers[lvc].el.style.width = cw + "px"; //$($t.grid.hDiv).find(‘.jqg-first-row-header th:eq(‘ + lvc + ‘)‘).css({ width: cw + "px" });//mod by xss //if(cle) { $t.grid.cols[lvc].style.width = cw+"px"; } if($t.p.footerrow) { //$t.grid.footers[lvc].style.width = cw+"px"; }
时间: 2024-10-13 23:21:24