Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Jul 2007
    Location
    Italy
    Posts
    134
    Vote Rating
    0
    fermo111 is on a distinguished road

      0  

    Default Ext.grid.GridPanel maxHeight config option is ignored

    Ext.grid.GridPanel maxHeight config option is ignored


    Ext version tested:
    • Ext 3.4.0

    Adapter used:
    • jquery

    css used:
    • only default ext-all.css



    Browser versions tested against:
    • FF 3.6.18 (firebug 1.7.3 installed)

    Operating System:
    • Ubuntu 10.04

    Description:
    • Setting the maxHeight config option on a Ext.grid.GridPanel does nothing. The ExtJS documentation says: "
      maxHeight : Number
      Sets the maximum height of the grid - ignored if autoHeight is not on.
      "


    Steps to reproduce the problem:
    • Take the array-grid.html example (ext/examples/grid/array-grid.html)
    • Change the file ext/examples/grid/array-grid.js at line 157 in the following way:
      //height: 350,
      autoHeight: true,
      maxHeight: 200,

    The result that was expected:
    • the grid is 200px high

    The result that occurs instead:
    • the grid height is such that all the rows are displayed (no vertical scrollbar)
    • bar

    Possible fix:

  2. #2
    Sencha User
    Join Date
    Jul 2007
    Location
    Italy
    Posts
    134
    Vote Rating
    0
    fermo111 is on a distinguished road

      0  

    Default


    bump

  3. #3
    Sencha User
    Join Date
    Feb 2009
    Posts
    9
    Vote Rating
    0
    jtruffot is on a distinguished road

      0  

    Default


    Hi,

    I confirm this bug. I adapted the fix proposed at http://www.sencha.com/forum/showthre...l=1#post146422:

    Code:
    Ext.grid.GridView.override({    layout : function(initial) {
            if (!this.mainBody) {
                return; // not rendered
            }
    
    
            var grid       = this.grid,
                gridEl     = grid.getGridEl(),
                gridSize   = gridEl.getSize(true),
                gridWidth  = gridSize.width,
                gridHeight = gridSize.height,
                scroller   = this.scroller,
                scrollStyle, headerHeight, scrollHeight;
            
            if (gridWidth < 20 || gridHeight < 20) {
                return;
            }
            
            if (grid.autoHeight) {  
                scrollStyle = scroller.dom.style;    
                if (Ext.isNumber(grid.maxHeight) && gridHeight > grid.maxHeight) {
                    gridHeight = grid.maxHeight;
                    this.el.setSize(gridWidth, gridHeight);
                    
                    headerHeight = this.mainHd.getHeight();
                    scrollHeight = gridHeight - headerHeight;
                    scroller.setSize(gridWidth, scrollHeight);
                    
                    scrollStyle.overflow = '';
                    scrollStyle.position = '';
                } else {
                    this.el.setSize();
                    scroller.setSize();
                    
                    scrollStyle.overflow = 'visible';
                    if (Ext.isWebKit) {
                        scrollStyle.position = 'static';
                    }
                }
            } else {
                this.el.setSize(gridWidth, gridHeight);
                
                headerHeight = this.mainHd.getHeight();
                scrollHeight = gridHeight - headerHeight;
                
                scroller.setSize(gridWidth, scrollHeight);
                
                if (this.innerHd) {
                    this.innerHd.style.width = (gridWidth) + "px";
                }
            }
            
            if (this.forceFit || (initial === true && this.autoFill)) {
                if (this.lastViewWidth != gridWidth) {
                    this.fitColumns(false, false);
                    this.lastViewWidth = gridWidth;
                }
            } else {
                this.autoExpand();
                this.syncHeaderScroll();
            }
            
            this.onLayout(gridWidth, scrollHeight);
        }
    });
    I am not sure it works in all cases. All my grids use auto width...

Thread Participants: 1