1. #1
    Ext User
    Join Date
    Jun 2010
    Posts
    8
    Vote Rating
    0
    alois.cochard is on a distinguished road

      0  

    Question Unanswered: Unable to extend Ext.data.JsonStore (proxy null)

    Unanswered: Unable to extend Ext.data.JsonStore (proxy null)


    Greetings,

    I'm trying to extend JsonStore to create reusable component to access my rest service.

    The following code works (no extend, in 'onReady'):
    Code:
    var store = Ext.data.JsonStore({
                 autoDestroy: true,
                 url: '/decks',
                 root: 'results',
                 restful: true,
                 idProperty: 'id',
                 mode: 'local',
                 fields: [{name: 'id', name: 'name'}]
    });
    
    store.load();
    But when I do this, the store didn't work:
    Code:
    Pomodeck.data.DeckStore = Ext.extend(Ext.data.JsonStore, {
        initComponent: function() {
            var config = {
                autoDestroy: true,
                url: '/decks',
                root: 'results',
                restful: true,
                idProperty: 'id',
                fields: [{name: 'id', name: 'name'}]
            }
    
            Ext.apply(this, Ext.apply(this.initialConfig, config));
            Pomodeck.data.DeckStore.superclass.initComponent.apply(this, arguments);
        }
    });
    
    Ext.onReady(function(){
        Ext.QuickTips.init();
    
        var store = new Pomodeck.data.DeckStore();
    
        store.load();
    });
    After looking inside ext-all-debug.js when doing 'store.load()' the proxy variable is not defined. Seems that some initialization logic isn't processed when extending. Any idea ?

    I never experienced such issues when extending other components.

    I've tried different 'way' of extending but nothing change, help more than welcome !

    Thanks

    Alois Cochard
    http://aloiscochard.blogspot.com
    http://www.twitter.com/aloiscochard

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    96
    Answers
    1
    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


    A store isn't a component. It has no initComponent method!

    For stores you will need to override the contructor instead.

  3. #3
    Ext User
    Join Date
    Jun 2010
    Posts
    8
    Vote Rating
    0
    alois.cochard is on a distinguished road

      0  

    Default


    AAAAH ! Shame on me ... really !

    Totally forgot that not everything is Component in ExtJs ... bad Java 'Object' habit :-(

    Thanks a lot, now that's rocks

    Alois Cochard
    http://aloiscochard.blogspot.com
    http://www.twitter.com/aloiscochard

Similar Threads

  1. [FIXED-1263] Ext.data.Proxy => Ext.data.DataProxy
    By plalx in forum Ext 3.x: Bugs
    Replies: 1
    Last Post: 13 Sep 2010, 4:18 PM
  2. Error this.proxy is null
    By alkasoam in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 30 Mar 2010, 6:25 AM
  3. [2.0-rc1] Unable to extend TreePanel
    By v_t_m in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 11 May 2009, 10:21 AM
  4. [2.0.2][CLOSED] data.JsonStore doesn't allow another proxy
    By andrei.neculau in forum Ext 2.x: Bugs
    Replies: 4
    Last Post: 27 Mar 2008, 11:32 AM

Thread Participants: 1

Tags for this Thread