Results 1 to 6 of 6

Thread: autoExpandColumn isn't autoExpanding

  1. #1
    Ext User
    Join Date
    Nov 2009
    Posts
    24

    Default autoExpandColumn isn't autoExpanding

    I think I'm following the docs correctly. All the columns are the same width (see attached screenshot), though I'm trying to get the "title" column to be as big as its content (which is I think what autoExpandColumn is for).

    What am I missing?

    Code:
    Ext.ns('EAA.custom');
    
    EAA.custom.DocumentGrid = Ext.extend(Ext.Panel, {
        
        constructor: function(config) {
            
            config = config || {};
            
            var store = new Ext.data.Store({
                autoLoad: true,
                url: 'documents/listDocuments.html',
                baseParams: {
                    start: 0,
                    limit: 50
                },
                reader: new Ext.data.JsonReader({
                    root: 'data',
                    totalProperty: 'count'
                }, ['id', 'commonId', 'title', 'isbn'])
            });
            
            Ext.apply(config, {
                layout: 'fit',
                height: 400,
                frame: true,
                title: "Documents",
                items: {
                    xtype: 'grid',
                    autoExpandColumn: 'title',
                    enableColumnHide: false,
                    store: store,
                    columns: [
                        { header: 'DocID',    dataIndex: 'id' },
                        { header: 'CommonID', dataIndex: 'commonId' },
                        { header: 'Title',    dataIndex: 'title', id: 'title' },
                        { header: 'ISBN',     dataIndex: 'isbn' }
                    ],
                    bbar: new Ext.PagingToolbar({
                        pageSize: 50,
                        store: store
                    })
                }
            });
            
            EAA.custom.DocumentGrid.superclass.constructor.call(this, config);
        }
    
    });
    
    Ext.reg('DocumentGrid', EAA.custom.DocumentGrid);
    Code:
    var documentGrid = new EAA.custom.DocumentGrid({
        id: 'documentGrid',
        renderTo: 'div_documentGrid'
    });
    
    <div id="div_documentGrid"></div>
    Attached Images Attached Images

  2. #2
    Ext JS Premium Member
    Join Date
    Jan 2010
    Location
    Austria
    Posts
    87

    Default

    the first that hasn't set forcefit:true
    the autoexpandcolumn options needs a id to be defined at
    the column you want to expand

  3. #3
    Ext User
    Join Date
    Nov 2009
    Posts
    24

    Default

    Quote Originally Posted by Nesta View Post
    the first that hasn't set forcefit:true
    I'll try setting that option to true.

    Quote Originally Posted by Nesta View Post
    the autoexpandcolumn options needs a id to be defined at the column you want to expand

    That's what I'm doing here, no?
    Code:
    { header: 'Title',    dataIndex: 'title', id: 'title' }

  4. #4
    Ext JS Premium Member
    Join Date
    Jan 2010
    Location
    Austria
    Posts
    87

    Default

    right id:'title' will fix your problem.

    don't set forceFit to true! this will disable the autoexpand option

  5. #5
    Ext User
    Join Date
    Nov 2009
    Posts
    24

    Default

    I don't think you understand.

    If you look at my original post, id: 'title' is already there.

    And forceFit defaults to false. I'm not setting forceFit anywhere, so it's already false.

  6. #6
    Ext JS Premium Member
    Join Date
    Jan 2010
    Location
    Austria
    Posts
    87

    Default

    sry haven't seen the id property.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •