Results 1 to 5 of 5

Thread: Remote proxy does not send store filters whose value is falsy

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-19699 in 5.1.3.228.
  1. #1
    Sencha Premium Member valio's Avatar
    Join Date
    Jan 2014
    Posts
    203

    Default Remote proxy does not send store filters whose value is falsy

    Affected versions:
    ExtJS 5.1.2
    (previous versions worked, ExtJS 6 seems to be unaffected)

    Description:
    When adding a store filter whose value is falsy (undefined, false, 0, null, NaN or "") no corresponding filter parameter is sent to the server by the proxy.

    Expected behaviour:
    The filter is sent to the server at least in cases where the filter value is false or 0.

    Test case:
    See this Fiddle https://fiddle.sencha.com/#fiddle/103n

  2. #2
    Sencha - Support Team keckeroo's Avatar
    Join Date
    Mar 2008
    Location
    Winnipeg, Canada
    Posts
    388

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha Premium Member valio's Avatar
    Join Date
    Jan 2014
    Posts
    203

    Default

    Since 5.1.3 is not out yet, I publish this override fix here

    Code:
    /**
     * This fixes a bug that was introduced wiht ExtJS 5.1.2 (but fixed in 5.1.3) whereby falsy filter values are not send
     * to a remote server. 
     * 
     * For details refer to 
     * https://www.sencha.com/forum/showthread.php?306266-Remote-proxy-does-not-send-store-filters-whose-value-is-falsy
     * 
     * @author:  Sencha (+ fix by Pat Mchler, IWF web solutions)
     * @license: Sencha Software License Agreement (https://www.sencha.com/legal/sencha-software-license-agreement/)
     */
    Ext.define('App.overrides.data.proxy.AllowFalsyRemoteFilterValues', {
        override: 'Ext.data.proxy.Server',
    
    
        //5.1.2
        compatibility : ['5.1.2.748'],
    
    
        //adapted version of method code from Ext.data.proxy.Server.encodeFilters found in ExtJS 5.1.2.748
        /**
         * Encodes the array of {@link Ext.util.Filter} objects into a string to be sent in the request url. By default,
         * this simply JSON-encodes the filter data
         * @param {Ext.util.Filter[]} filters The array of {@link Ext.util.Filter Filter} objects
         * @return {String} The encoded filters
         */
        encodeFilters: function(filters) {
            var out = [],
                length = filters.length,
                i, filter;
    
    
            for (i = 0; i < length; i++) {
                filter = filters[i];
    
    
                // Only filters with the two values, property, and value may be serialized
                // If it is a filter with a custom filterFn, it cannot be serialized.
                if (filter.getProperty() && filter.getValue()!==undefined) { // <=====  ADAPTED LINE HERE
                    out.push(filter.serialize());
                }
            }
    
    
            return this.applyEncoding(out);
        }
    });
    Last edited by valio; 10 May 2016 at 4:09 AM. Reason: (comment fix)

  4. #4
    Sencha Premium Member
    Join Date
    Sep 2011
    Posts
    123

    Default

    Hit me today! Wow 5.1.2 is from October 2015!!! And still no bugfix release for this... Seems there will never be any change regarding the release-cycle at Sencha. Annoying!

  5. #5
    Sencha Premium Member
    Join Date
    Sep 2011
    Posts
    123

    Default

    This bug affects ALL boolean-filters which are defined inside a grid. And still no fix released... Makes me speechless.

Similar Threads

  1. Replies: 5
    Last Post: 28 Jan 2016, 2:05 PM
  2. Replies: 2
    Last Post: 28 Nov 2014, 8:14 AM
  3. grid filters from remote store
    By pparsniak in forum Ext 5: Q&A
    Replies: 1
    Last Post: 27 Sep 2014, 7:44 AM
  4. Replies: 4
    Last Post: 9 Jun 2013, 3:02 PM
  5. [FIXED] [B2]Remote filters and sorters don't work on List using Proxy memory
    By robsonala in forum Sencha Touch 2.x: Bugs
    Replies: 5
    Last Post: 10 Feb 2012, 11:41 AM

Posting Permissions

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