Results 1 to 3 of 3

Thread: Add extra parameters to store filter

  1. #1
    Sencha User
    Join Date
    Mar 2011
    Location
    Arvada, CO
    Posts
    404
    Answers
    11

    Default Answered: Add extra parameters to store filter

    I have a store that gets filtered remotely. I'm creating x amount of Filter config objects and pushing them onto the store. What I need is for each Filter object to have a certain parameter that gets sent back to the server with the filter object, but unfortunately, it looks like what gets sent back to the server is locked down. This is an outline of what the Filter config object looks like:

    Code:
    var filters = [{
      property: 'service_name',
      value: ['123', '346'],
      inverted: true
    }, {
      property: 'service_id',
      value: [1, 5, 7]
      inverted: false
    }];
    store.addFilter(filterConfig);
    After store.addFilter fires, what gets sent is
    Code:
    "filter": [
      {"property": "service_name", "value": ["123", "346"]},
      {"property": "service_id", "value": [1, 5, 7]}
    ]
    What I need is that inverted property to be sent as well. I could use extraParams on the store, but then I'd have to devise some sort of system for matching it with the filter data, which I don't want to do. The other idea is overriding wherever these values get packaged up and sent to the server... I'm imagining that happens somewhere in the proxy or store? I know the filterchange event fires, but have yet to track down where it gets listened.

    I'm curious to know if anyone has any ideas on how to solve this? Any help would be appreciated.

  2. You could override the encodeFilters function in the store proxy to include the extra param in the filter.

  3. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410
    Answers
    716

    Default

    You could override the encodeFilters function in the store proxy to include the extra param in the filter.

  4. #3
    Sencha User
    Join Date
    Mar 2011
    Location
    Arvada, CO
    Posts
    404
    Answers
    11

    Default

    Yup, just hunted that down right before I left work. Thanks.

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
  •