When using gridpanel, we sometimes need to set autoheight: true. However, if the table width is greater than the container width, the excess content will be hidden without a horizontal scroll bar, the solution was found only after the boss tried to add the following attributes to the option config of gridpanel:
Viewconfig: {<br/> layout: function () {<br/> If (! This. mainbody) {<br/> return; // not rendered <br/>}< br/> var G = This. GRID; <br/> var c = G. getgridel (); <br/> var csize = C. getsize (true); <br/> var vw = csize. width; <br/> If (! G. hideheaders & (VW <20 | csize. height <20) {// display: <br/> // none? <Br/> return; <br/>}< br/> If (G. autoheight) {<br/> This. el. dom. style. width = "100%"; <br/> This. el. dom. style. overflow = "Auto"; <br/> This. el. dom. firstchild. style. overflow = "visible"; <br/> this.el.dom.firstchild.style.css float = "Left"; <br/> define float = "Left"; <br/> define float = "Left "; <br/> This. el. dom. firstchi LD. firstchild. firstchild. style. overflow = "visible"; <br/> This. el. dom. firstchild. firstchild. nextsibling. style. overflow = "visible"; <br/>} else {<br/> This. el. setsize (csize. width, csize. height); <br/> var hdheight = This. mainhd. getheight (); <br/> var VL = csize. height-(hdheight); <br/> This. scroller. setsize (VW, VL); <br/> If (this. innerhd) {<br/> This. innerhd. style. width = (VW) + 'px '; <br/>}< br/>} <Br/> If (this. forcefit) {<br/> If (this. lastviewwidth! = VW) {<br/> This. fitcolumns (false, false); <br/> This. lastviewwidth = VW; <br/>}< br/>} else {<br/> This. autoexpand (); <br/> This. syncheaderscroll (); <br/>}< br/> This. onlayout (VW, FLAC); <br/>}< br/>
Many problems have been encountered during the solution, such as incomplete background of the header, not all columns can be resize (resizable: True has been set), so there may be many problems I have not found. If anyone finds any problems, I hope you can give me some advice.
Modify:
Another simple method is found to be much better than the above method.
Viewconfig: {<br/> layout: function () {<br/> If (! This. mainbody) {<br/> return; // not rendered <br/>}< br/> var G = This. GRID; <br/> var c = G. getgridel (); <br/> var csize = C. getsize (true); <br/> var vw = csize. width; <br/> If (! G. hideheaders & (VW <20 | csize. height <20) {// display: <br/> // none? <Br/> return; <br/>}< br/> If (G. autoheight) {<br/> If (this. innerhd) {<br/> This. innerhd. style. width = (VW) + 'px '; <br/>}< br/>} else {<br/> This. el. setsize (csize. width, csize. height); <br/> var hdheight = This. mainhd. getheight (); <br/> var VL = csize. height-(hdheight); <br/> This. scroller. setsize (VW, VL); <br/> If (this. innerhd) {<br/> This. innerhd. style. width = (VW) + 'px '; <br/>}< br/> If (This. forcefit) {<br/> If (this. lastviewwidth! = VW) {<br/> This. fitcolumns (false, false); <br/> This. lastviewwidth = VW; <br/>}< br/>} else {<br/> This. autoexpand (); <br/> This. syncheaderscroll (); <br/>}< br/> This. onlayout (VW, FLAC); <br/>}< br/>}