1. #1
    Sencha User
    Join Date
    May 2009
    Posts
    136
    Vote Rating
    5
    DiscoBoy is on a distinguished road

      -1  

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

    Unanswered: 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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,548
    Vote Rating
    873
    Answers
    3566
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      2  

    Default


    You should have been using this.getProxy() instead of this.prototype.proxy
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Raleigh, NC
    Posts
    445
    Vote Rating
    270
    Answers
    23
    brian428 has much to be proud of brian428 has much to be proud of brian428 has much to be proud of brian428 has much to be proud of brian428 has much to be proud of brian428 has much to be proud of brian428 has much to be proud of brian428 has much to be proud of brian428 has much to be proud of

      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
    136
    Vote Rating
    5
    DiscoBoy is on a distinguished road

      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
    445
    Vote Rating
    270
    Answers
    23
    brian428 has much to be proud of brian428 has much to be proud of brian428 has much to be proud of brian428 has much to be proud of brian428 has much to be proud of brian428 has much to be proud of brian428 has much to be proud of brian428 has much to be proud of brian428 has much to be proud of

      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.

Thread Participants: 2