Results 1 to 4 of 4

Thread: Schema changing the proxy url

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-14694 in 5.1.5.
  1. #1
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Vote Rating
    393
      0  

    Default Schema changing the proxy url

    In ExtJS 4 a url could be specified on a proxy subclass no problem:

    Code:
    Ext.define('MyProxy', {
        alias: 'proxy.myproxy',
        extend: 'Ext.data.proxy.Ajax',
        
        url: 'myurl.json'
    });
    All stores and models using this proxy would then inherit this url.

    In ExtJS 5 it works fine if the proxy is used on a store but not a model. e.g.:

    Code:
    Ext.define('MyModel', {
        extend: 'Ext.data.Model',
    
        proxy: {
            type: 'myproxy'
        }
    });
    The problem is the schema generates a 'default' url for models and only the proxy's instance config is considered when applying this default, not the prototype chain.

    I haven't been able to find an elegant fix for this. I can call setUrl from within the constructor but that's just nasty. I wondered if anyone else had any thoughts?


  2. #2
    Sencha User
    Join Date
    Mar 2012
    Location
    Lawrence, KS
    Posts
    462
    Vote Rating
    92
      0  

    Default

    I went ahead and moved your thread to the Bugs forum and have pushed the issue to JIRA. Thanks for the report!

  3. #3
    Sencha Premium Member
    Join Date
    Oct 2013
    Location
    Huntsville, AL
    Posts
    1
    Vote Rating
    0
      0  

    Default

    One work-around without overriding the Proxy constructor is to set the proxy to an actual Proxy object instead of a config. To follow the example above:
    Code:
    Ext.define('MyProxy', {
        alias: 'proxy.myproxy',
        extend: 'Ext.dat.proxy.Ajax',
        url: 'data.json'
    })
    
    Ext.define('MyModel', {
        exend:'Ext.data.Model',
        fields: ['name'],
        proxy: Ext.Factory.proxy({
            type: 'myproxy'
        })
    })

  4. #4
    Ext JS Premium Member
    Join Date
    May 2008
    Location
    Austria, Vienna
    Posts
    260
    Vote Rating
    4
      0  

    Default

    I've encountered the same bug in ExtJS 6.0.2, subscribing in the hope it finally gets fixed.

Posting Permissions

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