1. #1
    Sencha User pablotcarreira's Avatar
    Join Date
    Feb 2012
    Location
    Brazil
    Posts
    12
    Vote Rating
    4
    pablotcarreira is on a distinguished road

      0  

    Default How to change filter encoding / override json proxy?

    Hi, I want to change the how the filter are encoded in a request. Extjs4 encode filters like that:

    Code:
    ?filter=[{"property":"foo","value":bar}]
    but I want the filters to come directly:
    Code:
    ?foo=bar
    My best guess is to override the proxy's encodeFilters function.
    I need help because I couldn't manage to override the proxy inside Architect because it's nested inside a model.

    Any help on how to do that? Is there a simpler way?

  2. #2
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,487
    Vote Rating
    140
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default

    Are you looking for simpleGroupMode or simpleSortMode?
    http://docs.sencha.com/ext-js/4-1/#!...impleGroupMode
    Aaron Conran
    @aconran

  3. #3
    Sencha User pablotcarreira's Avatar
    Join Date
    Feb 2012
    Location
    Brazil
    Posts
    12
    Vote Rating
    4
    pablotcarreira is on a distinguished road

      0  

    Default

    It's something like to have simpleGroupMode enabled, but instead of a direction it must send a parameter and a value for filtering.

    Example:
    I would like to ask the server for students with age of 10, that way:
    http://myurl.com/api/v1/students/?age=10

    But Extjs make the filtering like stated bellow and I don't want that:
    http://myurl.com/api/v1/students/?filter=[{'property':'age', 'value':10}]

    thx
    Last edited by pablotcarreira; 25 Jul 2012 at 4:28 AM. Reason: smiles

  4. #4
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,487
    Vote Rating
    140
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default

    This is a good feature request for the SDK team. There should be a similar configuration to send those params over the wire.

    You could implement that with an override (globally as an override). And then add the new configuration to the individual proxy you want to do it. Alternatively you could override all Server proxies to send filters in your preferred manner.
    Aaron Conran
    @aconran

  5. #5
    Sencha User pablotcarreira's Avatar
    Join Date
    Feb 2012
    Location
    Brazil
    Posts
    12
    Vote Rating
    4
    pablotcarreira is on a distinguished road

      0  

    Default

    Is there a way to override a proxy from inside Architect? I could only manage to override the model or the store, but not the proxy...

  6. #6
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,487
    Vote Rating
    140
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default

    There is not a way to create a subclass/override of your individual proxy but you can create an override that will do it for all proxies.
    Aaron Conran
    @aconran

  7. #7
    Sencha User mysticav's Avatar
    Join Date
    Mar 2007
    Location
    Mexico
    Posts
    522
    Vote Rating
    45
    mysticav will become famous soon enough mysticav will become famous soon enough

      0  

    Default

    Did anybody figure out this solution ?

    I also would like to send plain query parameters.

    By the way, why is this post here, instead of ExtJS 4 Q&A ?

Thread Participants: 2

Tags for this Thread