1. #1
    Sencha User
    Join Date
    Jan 2008
    Posts
    46
    Vote Rating
    0
    theyang is on a distinguished road

      0  

    Default this.config[col] is undefined

    this.config[col] is undefined


    Hello,

    Can someone please tell me what's wrong with the code? I keep recieving

    "this.config[col] is undefined
    return this.config[col].width || this.defaultWidth;"

    error when I create a NewUserForm object and place it in a container.
    Code:
     Application.NewUserForm = Ext.extend(Ext.form.FormPanel, {
    
        initComponent: function() {
        
            var store = new Ext.data.SimpleStore({
                fields: [
                   {name: 'userName'},
                   {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
                ]
            });
                    
            var checkColumn = new Ext.grid.CheckColumn({
               header: "IsInRole?",
               dataIndex: 'isInRole',
               width: 55
            });
            
            var grid = new Ext.grid.GridPanel({
                store: store,
                columns: [
                    {id:'userName',header: "User Name", width: 160, sortable: true, dataIndex: 'userName'},
                    {header: "", width: 85, sortable: true, dataIndex: 'lastChange'}
                ],
                stripeRows: true,
                autoExpandColumn: userName',
                height:350,
                width:600,
                title:'Select Roles'
            });     
    
            Ext.apply(this, {
                baseCls     : 'x-plain',
                border      : true,
                defaultType : 'textfield',
                items: [{
                    fieldLabel: 'Find a user',
                    xtype   : 'trigger',
                    name    : 'userName',
                    width   : '200',
                    onTriggerClick: function() {
                        Application.ShowUserSelection();
                    }
                }, grid]
            });
            
            Application.NewUserForm.superclass.initComponent.call(this);
    
        } // initComponent
        
    });
    
    Ext.reg('newuserform', Application.NewUserForm);

  2. #2
    Ext User guys2008's Avatar
    Join Date
    Jul 2008
    Posts
    104
    Vote Rating
    0
    guys2008 is on a distinguished road

      0  

    Default


    How about setting the width of your FormPanel to a number and not to a string .... ?
    Guys

  3. #3
    Sencha User
    Join Date
    Jan 2008
    Posts
    46
    Vote Rating
    0
    theyang is on a distinguished road

      0  

    Default


    The form runs without problems when I remove the grid definition. So I think this is something about the grid, not the form itself...

    Any ideas, I am stuck!

  4. #4
    Ext User guys2008's Avatar
    Join Date
    Jul 2008
    Posts
    104
    Vote Rating
    0
    guys2008 is on a distinguished road

      0  

    Default


    At a glance, I just found another syntax mistake when you wrote
    Code:
                autoExpandColumn: userName',
    in the grid definition, without any opening apostrophe to userName.

    if it's not this we'll look deeper...
    Guys

  5. #5
    Sencha User
    Join Date
    Jan 2008
    Posts
    46
    Vote Rating
    0
    theyang is on a distinguished road

      0  

    Default


    I removed the autoExpand attribute. Nothing's changed. Same error, and the grid is not rendered. I tried removing the column definitions but the error is not resolved. It's becase of the grid but I can't find why.

  6. #6
    Ext User
    Join Date
    Aug 2008
    Posts
    2
    Vote Rating
    0
    Eric Peers is on a distinguished road

      0  

    Default


    I have the same issue...

    Maybe this will help:
    I traced the code in ext-all-debug.js, line 31523/31524.
    it returns -1 if it cannot find indexById. Something is going wrong with my xml vs. column headers. The problem occurs in the rendering of the grid when it tries to size everything.

    I think it is related to a symbolic lookup of "name" vs. the integer index of "0".

    --eric

  7. #7
    Sencha User
    Join Date
    Jan 2008
    Posts
    46
    Vote Rating
    0
    theyang is on a distinguished road

      0  

    Default


    I tried copying the grid from the example and running with the same configuration but the error is still there? Can it be something with my form creation routine?

  8. #8
    Ext User
    Join Date
    Aug 2008
    Posts
    2
    Vote Rating
    0
    Eric Peers is on a distinguished road

      0  

    Default possible solution + how to debug best?

    possible solution + how to debug best?


    Turns out my problem was in the definition of Ext.grid.ColumnModel. My autoexpand column which I selected in the definition of the grid was "name":

    autoExpandColumn:"name",

    this means that I needed a corresponding definition in the ColumnModel with an "ID". I thought the ID was referring to the XML record, but it's referring to an ID in the column Model:

    {id: 'name', header: "Project Name", width:200, sortable:true, dataIndex:"name"}

    if you don't have the ID it will fail to compare, return -1 for the call at ext-all-debug.js:31525
    var ci = cm.getIndexById(g.autoExpandColumn);

    is there a "slower" version of ext-all that checks return values for error conditions that I can "debug" with? Then I would switch to the optimized version once I have things running

  9. #9
    Ext Premium Member
    Join Date
    Jan 2008
    Posts
    19
    Vote Rating
    0
    wsn24x7 is on a distinguished road

      0  

    Default I have comment the 'autoExpandColumn' and it works!

    I have comment the 'autoExpandColumn' and it works!


    I had the same issue, but after reading this thread, I have commented the 'autoExpandColumn' and works fine for me.

    //autoExpandColumn: 'userName',

    Thanks

  10. #10
    Ext User
    Join Date
    Dec 2008
    Posts
    16
    Vote Rating
    0
    arajapandi is on a distinguished road

      0  

    Default


    hai,

    try with the below code

    {id:'name',header: "name",width: 75, sortable: true, dataIndex: 'name'},
    .
    .
    .
    autoExpandColumn:"name"

    this will work

    Thanks,
    Rajapandian.