Results 1 to 5 of 5

Thread: Ext 4.2: Why model prototypes do not have a proxy instance any longer

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    May 2009
    Posts
    144
    Vote Rating
    14
      -1  

    Default Ext 4.2: Why model prototypes do not have a proxy instance any longer

    This is something I absolutely h*** about ExtJS. All the internal changes constantly breaking code...

    ...so the problem is that I was creating a static model function using the previously proxy instance in a model.

    Code:
    Ext.define('App.model.app.Server', {
        extend: 'Ext.data.Model',
        proxy: {...}
    
        statics: {
            connect: function() {
                this.prototype.proxy.doSomething()
            }
        }
    });
    Now, the proxy is only the config object, but no real instance any longer. I guess this was introduced to use less memory and to create less object instances, or? Is there any other reason for this?

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Answers
    3931
    Vote Rating
    1271
      2  

    Default

    You should have been using this.getProxy() instead of this.prototype.proxy
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Raleigh, NC
    Posts
    501
    Answers
    23
    Vote Rating
    464
      2  

    Default

    Quote Originally Posted by DiscoBoy View Post
    This is something I absolutely h*** about ExtJS. All the internal changes constantly breaking code...Now, the proxy is only the config object, but no real instance any longer. I guess this was introduced to use less memory and to create less object instances, or? Is there any other reason for this?
    If you bypass the public API and go digging into objects, you really can't act shocked if an internal change breaks your code.

  4. #4
    Sencha User
    Join Date
    May 2009
    Posts
    144
    Vote Rating
    14
      0  

    Default

    I'm sorry for writing this a bit harsh. I just noticed it quite often that things change fundametely between every minor version. I helped myself now exactly with

    Code:
    this.setProxy(this.prototype.proxy);
    in my static method. As background information I overwrite the Ext.data.Model.load method of the model in a Factory class approach. Sometimes you have to bypass the public API.

    Thx for your replies

  5. #5
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Raleigh, NC
    Posts
    501
    Answers
    23
    Vote Rating
    464
      0  

    Default

    Quote Originally Posted by DiscoBoy View Post
    I overwrite the Ext.data.Model.load method of the model in a Factory class approach. Sometimes you have to bypass the public API.
    Oh, I totally agree. I've had to override plenty of things to work around problems or limitations in Ext JS. I'm just saying that when we do that, we really can't be surprised if something changes that messes things up. It can definitely be annoying, but internal changes that break overrides and such still has to be kept in mind as a very likely possibility.

Posting Permissions

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