Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Touch Premium Member
    Join Date
    Sep 2011
    Posts
    9
    Vote Rating
    0
    ilmcon is on a distinguished road

      0  

    Default ExtJS 4.2.1 column autosize won't work

    ExtJS 4.2.1 column autosize won't work


    Hi there,
    whenever i try to automatically adjust the column size with column,autoSize() i get an error and the grid is not displayed correctly. I added a Listener to the view of the grid so that it automatically checks, if a column should be autosized or not. Here is my code:

    Code:
    this.getView().addListener('refresh', function (view) {
            Ext.each(view.panel.headerCt.columnManager.columns, function (c) {
                if (c.autoWidth) c.autoSize();
                console.log(c);
            });
    });
    And Chrome tells me this:

    Code:
    msg: Uncaught TypeError: Cannot read property 'dom' of undefined
    
    
    url: http://ilmcon/js/resources/extjs/ext-all-debug.js
    
    
    line: 106058
    
    
    stack: TypeError: Cannot read property 'dom' of undefined
        at Ext.define.getMaxContentWidth (http://ilmcon/js/resources/extjs/ext-all-debug.js:106058:33)
        at Ext.define.autoSizeColumn (http://ilmcon/js/resources/extjs/ext-all-debug.js:106034:34)
        at Ext.define.autoSizeColumn (http://ilmcon/js/resources/extjs/ext-all-debug.js:109429:18)
        at Ext.define.autoSize (http://ilmcon/js/resources/extjs/ext-all-debug.js:109888:33)
        at null.<anonymous> (http://ilmcon/js/desktop/app/view/grids/filterGrid.js?_dc=1388407912294:236:40)
        at Object.Ext.Array.each (http://ilmcon/js/resources/extjs/ext-all-debug.js:1396:28)
        at null.<anonymous> (http://ilmcon/js/desktop/app/view/grids/filterGrid.js?_dc=1388407912294:235:21)
        at fire (http://ilmcon/js/resources/extjs/ext-all-debug.js:9818:49)
        at continueFireEvent (http://ilmcon/js/resources/extjs/ext-all-debug.js:11210:47)
        at fireEventArgs (http://ilmcon/js/resources/extjs/ext-all-debug.js:11188:26)
    I really appreciated your help!

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,154
    Vote Rating
    475
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    What is your goal .. to have the columns auto-size based on the width of the grid, or to have to columns size based on the content of the field.

    For the grid size, simply assign flex value to each column. If you want to change the size based on content, you can use autoSizeColumn() // same as expandToFit() in 4.1

Thread Participants: 1