You found a bug! We've classified it as TOUCH-4736 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Jul 2011
    Location
    Holland
    Posts
    95
    Vote Rating
    0
    mrduck is an unknown quantity at this point

      0  

    Default No filter and sorting, on Store with SQL proxy.

    No filter and sorting, on Store with SQL proxy.


    ST version tested:
    • Sencha Touch 2.2.1
    Browser versions tested against:
    • Chrome 28.0.1500.71
    • Safari 6.0.5
    • Both tested in OS X "Mountain Lion"
    DOCTYPE tested against:
    • Just default ST doctype, generated by Sencha CMD
    Description:
    When using a store with an SQL Proxy, the Store methods 'filter' and 'sort' wont work anymore.

    Steps to reproduce the problem:
    Just create a store with and without an Sql proxy and try to filter or sort. See the example code.

    The result that was expected:
    I except the same sort en filter behavior, which doesn't depend on using an Sql proxy or not.

    The result that occurs instead:
    Sorting and filtering doesn't work on the Sql proxy.

    Test Case:

    Store with Sql proxy:
    PHP Code:
    var store = new Ext.data.Store({
        
    requires: [
            
    'Ext.data.proxy.Sql'
        
    ],
         
    proxy: {
            
    type'sql',
            
    table'company'
         
    },
        
    fields : ['foo'],
        
    data   : [
            { 
    foo 'a' },
            { 
    foo 'b' }
        ]
    });


    console.log(store.getCount()); //2


    store.filter('foo''c');

    console.log(store.getCount()); //Should give 0, gives 2 instead. It didn't filter at all. 
    Store without Sql proxy:
    PHP Code:
    var store = new Ext.data.Store({
        
    fields : ['foo'],
        
    data   : [
            { 
    foo 'a' },
            { 
    foo 'b' }
        ]
    });


    console.log(store.getCount()); //2


    store.filter('foo''c');

    console.log(store.getCount()); // Returns 0, which is as expected. 
    I'd appreciate an temporally fix (override) so I can use the filter and sorting options in the application.

    Thank you,

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Vote Rating
    751
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


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

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Location
    Holland
    Posts
    95
    Vote Rating
    0
    mrduck is an unknown quantity at this point

      0  

    Default


    I found a possible workaround, but I'm not fully aware of any side effects.

    The variable "isSQLProxy" is set on TRUE in the Sql Proxy. When you put it on false in an override, the filter and sort functions do work again.

    PHP Code:
    Ext.define('Vetapp.override.data.proxy.Sql', {    
           
    override'Ext.data.proxy.Sql',    
           
    isSQLProxyfalse
    }); 
    I looks like this variable is only used in some parts related to sorting, grouping and filtering. Based on my own tests, this change doesn't do harm.

  4. #4
    Sencha User
    Join Date
    Aug 2013
    Posts
    3
    Vote Rating
    0
    mxcpin is on a distinguished road

      0  

    Default


    I'm also dealing with this problem and I have some more information and thoughts:

    The problem comes from the Store functions applyRemoteFilter/Sort/Group, which are explicitly checking if the store uses the Sql proxy and in that case automatically activate remoteFilter/Sort/Group.

    As a consequence, updateRemoteFilter() is calling data.setAutoFilter(false); so data is not automatically filtered.

    As documented in the Store class, if remoteFilter is set to true, "you will have to manually call the load method after you filter to retrieve the filtered data from the server". The same for remoteSort.

    Here there is at least a documentation problem, as this configs are documented to default to false. But they're "magically" changed to true. There are also no hints in the Sql proxy documentation.

    I expected that an alternative solution would be to use the Store's filterBy() instead of filter(), since contrary to filter()'s documentation, it doesn't mention that load() has to be manually called, and that would make sense because a filter function can, in principle, never be applied remotely. But it doesn't work because filterBy() internally calls filter(), leading to the same problem.

    Maybe the reason to do this was efficiency, trusting that filtering/sorting by the browser's WebSQL engine and reloading the data is faster than doing it in the set of loaded data. In my opinion, ideally this would be done transparently, internally in the Sql proxy, not forcing a Store-level load, but I understand that filter() is expected to work synchronously and WebSQL is asynchronous.

    A related problem is that the Sql proxy handles only simple sorters (sort by field values) when reading data, but sorter functions are ignored. This is also fixed with mrduck's workaround (overriding isSQLProxy to false; but as I said probably with that workaround we're losing efficiency when using simple filters and sorters).

    As a conclusion, I think that the programmer should be able to choose, leaving the defaults for those configs to false, and explaining in the Sql proxy documentation that you can get better efficiency for simple filters/sorters by activating them. And in that case, sorter functions should not be ignored by the Sql proxy read() function.

    Thanks.

Thread Participants: 2

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar