1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    15
    Vote Rating
    0
    Kah0ona is on a distinguished road

      0  

    Question Sorter[]/Filter[] are not added to Ext.data.Operation. Bug?

    Sorter[]/Filter[] are not added to Ext.data.Operation. Bug?


    Hello,

    I am using the following Store, in combination with the following Operation to fetch data from a proxy (fetch_proxy.php). The sorters and filters array should add parameters to the url of this proxy. Except it doesn't work, the default parameters are appended to the url, not my 'overriding' config, if I look at the resulting GET request.

    Am I doing something wrong, or is this a bug?

    In other words: how to add parameters to the url of a proxy?
    Code:
    Ext.define('myApp.store.Combined', {
    	extend: 'Ext.data.Store',
    	config : {
    		model: 'myApp.model.Shops',
    		proxy : {			
    			type: 'ajax',
    			url: 'fetch_proxy.php',
    			reader: 'json'	
    		}
    	},
    	
    });
    
    
    Ext.define('myApp.store.ListOperation',{
    	extend: 'Ext.data.Operation',
    	config:{
    		model: 'myApp.model.Shops',
    		action: 'read',
    		sorters: [
    			new Ext.util.Sorter({
    				property: 'distance',
    				direction: 'ASC'
    			})
    		],
    		filters: [
    			new Ext.util.Filter({
    				property: 'lng',
    				value: 0
    			}),
    			new Ext.util.Filter({
    				property: 'lat',
    				value: 0
    			})
    		]
    	}
    
    
    });
    
    
    //load it, in app.js...
    myApp.combinedStore = Ext.create('myApp.store.Combined');
    myApp.listOperation = Ext.create('myApp.store.ListOperation');
            
    myApp.combinedStore.load(myApp.listOperation);
    This method did work in Sencha touch 1, but not in Touch 2.

    Any ideas?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,649
    Vote Rating
    898
    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


    Why aren't you adding the sorter and filter to the store?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

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

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    15
    Vote Rating
    0
    Kah0ona is on a distinguished road

      0  

    Default


    Thanks for your quick response.

    We don't add it to the Store because the filtering/sorting is done on the server behind the proxy.

    So we want Sencha to make a GET request like this:
    fetch_proxy.php?filters=[{......}]&sort=[{....}]

    But now it just does the default request with default start, limit, etc, eventhough we tried to override it with our custom sorters/filters (this url is generated by Sencha, instead of one with our filters/sorters: http://m.myapp.nl/beta/fetch_proxy.p...25&action=read)
    This used to work in Sencha 1.

    Bottom line: We can't load everything in Sencha, and then filter it locally, so we want to send parameters to the server.

    How can we achieve this?

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,649
    Vote Rating
    898
    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


    You can use remoteSort and remoteFilter
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

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

  5. #5
    Sencha User
    Join Date
    Nov 2011
    Posts
    15
    Vote Rating
    0
    Kah0ona is on a distinguished road

      0  

    Default


    Thanks that worked great! So, should the docs of Operation be updated? Because it still talks abou filters / sorters.

  6. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,649
    Vote Rating
    898
    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


    No really. It's good that people understand that there is a class there. It really should be marked private IMO.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

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

Thread Participants: 1

Tags for this Thread