1. #1
    Ext User
    Join Date
    Oct 2008
    Posts
    195
    Vote Rating
    0
    aj3423 is on a distinguished road

      0  

    Default problem with ColumnModel.setConfig

    problem with ColumnModel.setConfig


    Code:
     
    grid.getColumnModel().setConfig(config);
    thie config is an array:
    [{header:xx, dataIndex:xx, id:xx, sortable:true, width:80}, {...} ... {...}]

    there is an error when I click the header, and another error when click the 'Sort Ascending' or 'Sort Decending', what is missed for the config?

    the config and error message can be seen in firebug:
    Thsnks.
    Attached Images

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    91
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    You probably specified a dataIndex that isn't in the store.

    ps. If you change both the store and the columns you need to call grid.reconfigure instead.

  3. #3
    Ext User
    Join Date
    Oct 2008
    Posts
    195
    Vote Rating
    0
    aj3423 is on a distinguished road

      0  

    Default


    I tried grid.reconfigure like this:
    Code:
    grid.getColumnModel().setConfig(config);
    grid.reconfigure(grid.store, grid.getColumnModel());
    but still has the problem..
    how to dynamically change the column..

  4. #4
    Ext User
    Join Date
    Oct 2008
    Posts
    195
    Vote Rating
    0
    aj3423 is on a distinguished road

      0  

    Default


    I tried your plugin for ext2 at :
    http://extjs.com/forum/showthread.php?t=53009

    and get this error,
    this.recordType is undefined

    this.recordType.prototype.fields.replace(field);

  5. #5
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    91
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    1. You don't need to call setConfig if you already call reconfigure (reconfigure calls setConfig).
    2. I think you created your store incorrectly. You need to create it with a reader with at least one field.

  6. #6
    Ext User
    Join Date
    Oct 2008
    Posts
    195
    Vote Rating
    0
    aj3423 is on a distinguished road

      0  

    Default


    Oh it is the problem, after adding a fields property, everything is ok.
    Thanks again Condor!
    Code:
    myReader = new Ext.data.JsonReader({
       fields: ['xx'],
       root : 'ddd',
       totalProperty : 'totalCount'
      });

Thread Participants: 1