After testing, the Setgridwidth method is not the width of the first line, but the width of the first row. So add the width of the first line.
The last few lines of code change the width of the last column, but it is not used. The scroll bar is outside the table.
Local 4263 lines Start
$.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"}); when the//mod by XSS window is scaled, the pair is not aligned 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.wid th = cw+ "px"; }if ($t. P.footerrow) {//$t. Grid.footers[lvc].style.width = cw+ "px";}
Jqgrid v5.0.1 When the number of columns setgridwidth the table header and the content is not aligned