-
8 Oct 2012 2:06 AM #1
[2.1.0-RC1] Ext.data.proxy.SQL doesn't implement remote filtering and sorting
[2.1.0-RC1] Ext.data.proxy.SQL doesn't implement remote filtering and sorting
Hi,
I'm trying to use the new SQLite proxy from Sencha Touch 2.1, but just seen that remote filtering and sorting is not implemented by this proxy and I'm stuck in implementing the following use case:
How can I simulate this SQL query:Code:Ext.define('App.model.Game', { extend: 'Ext.data.Model', config: { fields: [ { name: 'id', type: 'int' } ], hasMany: { model: 'App.model.Action' } proxy: { type: 'sql' } } }); Ext.define('App.model.Action', { extend: 'Ext.data.Model', config: { fields: [ { name: 'id', type: 'int' }, { name: 'game_id', type: 'int' }, { name: 'date', type: 'date' }, ], belongsTo: { model: 'App.model.Game' }, proxy: { type: 'sql' } } });
If I do this:Code:SELECT * FROM action WHERE game_id == 1 ORDER BY date DESC LIMIT 0, 1
this SQL query is executedCode:var store = Ext.create('Ext.data.Store', { model: 'App.model.Action', remoteFilter: true, remoteSort: true, filters: [{property: 'game_id', value: 1}], sorters: [{property: 'date', direction: 'DESC'}], }); store.load(function() { console.log(store.first()); });
and the first record of my store is not the youngest one. Also, if there is more than 25 records in my table, I will be able to locally filtering/sorting only the first 25 records ... and I don't want to retrieve all records of my database (i.e. pageSize: 9999999?).Code:SELECT * FROM Action LIMIT 0, 25
Another major issue is that association doesn't work because of the lack of remote filtering implementation (the game.actions() store will contains the 25 first records even records with 'game_id' != game.get('id')).
Do I missed something in the model/store logic ?
Thanks
-
8 Oct 2012 9:48 AM #2Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,658
- Vote Rating
- 14
Thanks for the report! I have opened a bug in our bug tracker.
-
11 Oct 2012 7:28 AM #3Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Haarlem, Netherlands
- Posts
- 1,235
- Vote Rating
- 5
This has been fixed and will be part of the next release. Thanks for the reminder

Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-3551
in
Sprint 26 (2.1.0-rc2).


Reply With Quote
