You found a bug! We've classified it as EXTJSIV-4319 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Touch Premium Member
    Join Date
    Oct 2011
    Posts
    37
    Vote Rating
    0
    rfox is on a distinguished road

      0  

    Question Use a field other than 'id' for server calls?

    Use a field other than 'id' for server calls?


    Apologies if this has been asked before its hard to search for

    Given a model/store with a defined and working proxy, how do i configure it so it does not submit server calls using id.

    For example say i have a server side file representing Cars eg(data/cars.json) and i want to load car 3:
    Code:
    model.load(3,success...fail...etc
    Firebug always shows my browser as requesting data/cars.json?id=3.

    What if i wanted it to use 'carid' eg data/cars.json?carid=3?

    Is this possible? I've looked into using the idProperty field in a model but it is either ignored or that's not what it actually does.

    I believe what i want is similar to the mapping property that you can define in a writer except for reading.

  2. #2
    Sencha User
    Join Date
    Oct 2011
    Location
    Sweden
    Posts
    36
    Vote Rating
    0
    JambaFun is on a distinguished road

      0  

    Default


    Hi rfox,

    This one is so ugly that I'm not even sure I want to post it, but close inspection of Ext.data.Model, Ext.data.proxy.Server and Ext.data.proxy.Ajax only gave one possible solution:
    Code:
    model.load(false, {
        params: {carid: 3}
    });
    Best Regards

  3. #3
    Touch Premium Member
    Join Date
    Oct 2011
    Posts
    37
    Vote Rating
    0
    rfox is on a distinguished road

      0  

    Default


    That's really anoying, id is a reserved cgi variable in both POST and GET for the server side software im using. Pretty much everywhere I want to load data I cannot use ID as its parameter.

    The definition of idProperty on the docs is also confusing . Looks like it only affects the internal storage of the model.

    Thanks for your input

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,624
    Vote Rating
    435
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    I have moved this to the bugs forum and entered as a bug as the idProperty should change the parameter that is sent back. This isn't a bug per-say but an improvement.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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

  5. #5
    Touch Premium Member
    Join Date
    Oct 2011
    Posts
    37
    Vote Rating
    0
    rfox is on a distinguished road

      0  

    Default


    Thanks for moving it to bugs its good to know its been acknowledged

  6. #6
    Sencha User
    Join Date
    Jun 2010
    Location
    Buenos Aires, Argentina
    Posts
    213
    Vote Rating
    8
    ldonofrio will become famous soon enough

      0  

    Default


    same problem here, loose 1 day trying to override this and nothing