Results 1 to 7 of 7

Thread: Model and Rest proxy. Query id parameter in the GET request url

  1. #1
    Sencha User
    Join Date
    May 2010
    Location
    Omsk, Russia
    Posts
    5
    Vote Rating
    0
      0  

    Default Model and Rest proxy. Query id parameter in the GET request url

    Hi everyone.

    I'm a little bit stuck here. My model code is


    Code:
    Ext.define('MyFancyModel', {
        extend: 'Ext.data.Model',
        fields: [
            { name: 'id', type: 'string' },
            { name: 'name', type: 'string' }
        ],
        proxy: {
            type: 'rest',
            url: '/fancymodel',
            noCache: false
        }
    });

    When I try to load data by id using

    Code:
    Ext.ModelManager.getModel('MyFancyModel').load('some-id', {});

    the request url is /fancymodel/some-id?id=some-id which is obviously not correct. Is there any way to achieve the right request url /fancymodel/some-id without any patches or overrides?

    JSFIDDLE

    In the developer console you can see failed GET request
    Code:
    http://fiddle.jshell.net/fancymodel/some-id?id=some-id


  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,026
    Vote Rating
    1367
      0  

    Default

    What Ext JS 4.x.x version are you using? I believe this was fixed in 4.1.3 and 4.2.0
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    May 2010
    Location
    Omsk, Russia
    Posts
    5
    Vote Rating
    0
      0  

    Default

    4.1.1a

  4. #4
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,026
    Vote Rating
    1367
      0  

    Default

    In 4.1.3 and 4.2.0 this has actually been fixed and a new config was added to opt in to sending the id parameter meaning by default it won't send it.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  5. #5
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Vote Rating
    392
      0  

    Default

    My own observation is that the parameter is still being sent with 4.2.0.

    Any hints what the setting is called? I've just looked through the 4.2 source code and it isn't immediately obvious.

    It'd be nice if idParam could be set to null but, unfortunately, that doesn't work.

  6. #6
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Vote Rating
    392
      0  

  7. #7
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,026
    Vote Rating
    1367
      0  

    Default

    Quote Originally Posted by skirtle View Post
    With an override provided.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

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
  •