Results 1 to 2 of 2

Thread: 6.0.2 Constructing a grid panel with store causes exception due to no 'viewConfig'

  1. #1
    Sencha Premium Member
    Join Date
    Aug 2012
    Posts
    30
    Answers
    1

    Default Answered: 6.0.2 Constructing a grid panel with store causes exception due to no 'viewConfig'

    I have a scenario where I want to be able to construct a grid panel with a store object that's already been instantiated, which seems like a valid thing to do per the API doc. Like this:

    Code:
        myStore = Ext.create('MyApp.stores.MyStore',
               ...
        )
        
        Ext.create('MyApp.grids.MyGridPanel',
                store: myStore
                ...
        )

    The superclass constructor chain eventually calls `initConfig` which calls `setStore` which calls `reconfigure` which calls `getView`. The problem is that `getView` then tries to access `this.viewConfig` which hasn't been supplied because there's no need to override the defaults.

    The problem seems to be that `this.viewConfig` doesn't get initialized until `initComponent` is called so it isn't available during construction of the grid panel.

    I can find a workaround for this, but it seems like a bug to me and something that worked as advertised in 4.2. It seems like maybe the `setStore` call that gets triggered during `initConfig` shouldn't try to reconfigure things during construction or perhaps `viewConfig` should be initialized to empty object in the constructor instead of `initComponent`.

    Thanks

  2. Well, once again posting out here caused me to find my issue within minutes. The problem seems to be that MyGridPanel was defined like this:

    Code:
    Ext.define('MyApp.grids.MyGridPanel'
        extend: 'Ext.grid.Panel'
    
    
        config:
            store: null
         ...
    )
    The gratuitous 'store' config on my subclass is apparently what triggered the 'setStore' call in the first place. Once I removed that, the chain of events described above no longer happens.

    I haven't figured out how the base classes are getting around the 'setStore' call from within 'initConfig', but I guess I'll move along.

    Thanks

  3. #2
    Sencha Premium Member
    Join Date
    Aug 2012
    Posts
    30
    Answers
    1

    Default

    Well, once again posting out here caused me to find my issue within minutes. The problem seems to be that MyGridPanel was defined like this:

    Code:
    Ext.define('MyApp.grids.MyGridPanel'
        extend: 'Ext.grid.Panel'
    
    
        config:
            store: null
         ...
    )
    The gratuitous 'store' config on my subclass is apparently what triggered the 'setStore' call in the first place. Once I removed that, the chain of events described above no longer happens.

    I haven't figured out how the base classes are getting around the 'setStore' call from within 'initConfig', but I guess I'll move along.

    Thanks

Similar Threads

  1. Replies: 1
    Last Post: 9 Aug 2012, 2:43 PM
  2. Ext.grid.plugin.DragDrop in viewConfig on Ext.grid.Panel
    By eltigree in forum Ext: Discussion
    Replies: 0
    Last Post: 5 Oct 2011, 5:18 AM
  3. Replies: 2
    Last Post: 8 Sep 2011, 8:27 AM
  4. Replies: 0
    Last Post: 27 Jul 2011, 1:08 AM
  5. 4.0.2 Ext.tree.Panel bug with viewConfig
    By grisevich in forum Ext:Bugs
    Replies: 0
    Last Post: 14 Jun 2011, 4:55 AM

Tags for this Thread

Posting Permissions

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