-
5 Jul 2012 5:50 AM #111
This is the Model code
Here is the list declarationCode:Ext.define('NDP.model.menuList', { extend: 'Ext.data.Model', config : { fields: [ {name: 'menuID', type: 'string'}, {name: 'menuName', type: 'string'}, {name: 'menuParentID', type: 'string'}, {name: 'menuParentName', type: 'string'}, {name: 'pattuName', type: 'string'}, {name: 'leaf', type: 'boolean'}, {name: 'createdBy', type: 'string'} ], proxy: { type: 'sqlitestorage', dbConfig :{ tablename : 'menuList', dbConn: NDP.util.InitSQLite.getConnection() }, reader : { idProperty : 'menuID', type:'array' } }, writer: { type: 'json' } } });
As I mentioned the store is loaded with 154 records now (as per in DCode:{ xtype: 'list', flex:1, // allowDeselect:true, deselectOnContainerClick:true, store: 'menuList', itemTpl:'<span class="item-title">{menuName}</span><tpl if="leaf !== true"><span class="x-list-disclosure"></span></tpl>', id:'menuListView', scrollable:'vertical'}
issue is that list still keeps showing loading (no data visible).
-
5 Jul 2012 5:54 AM #112
So I don't know if this is the issue stopping it here, but you need the first field of the model to just be called "id" of type integer. It must be exactly that and it's case sensitive. The proxy does not take not of the idProperty config - comment the whole reader bit out of the config to be safe.
Hopefully it will work then! I imagine the transaction is not returning because it's trying to set a field on the model ("id"), that doesn't exist.
-
6 Jul 2012 4:25 AM #113
The defined associations didn't have any affect on that. It was the same after removing the definitions from the models.
Finally I have found that it was down to the autoLoad and autoSync flags. By some reason multiple records are created when these flags are on. It's quite weird.
-
6 Jul 2012 4:26 AM #114
I could see how that might happen if you were manually calling store.sync as well as letting the autosync try to sync it?
-
6 Jul 2012 4:35 AM #115
Yep, exactly that was the case.
-
11 Jul 2012 8:04 AM #116
@martv: i had the same "SECURITY_ERR: DOM Exception 18" error during a package build.
I was able to resolve this by setting dbSize back to 5mb
-
12 Jul 2012 4:47 AM #117
Working mucho excellente. Thank you !!! :-)
How are you doing a select statement on a table, to query certain records?
So far I started with this, but don't know how to continue:
Code:var myStore = Ext.getStore('SQLiteDB'); var p = myStore.getProxy(); // p.doThatSexyQueryNow!!!!(); ;)
Please, please please please please provide a simple example on how to do a simple SELECT :-)
-
12 Jul 2012 5:07 AM #118
The proxy supports remoteFilter's and I believe sorts too... what do you need to do with a select query that you can't do with those? e.g. turn remoteFilter on on the store, set a filter on the store and load the store, and the proxy will create a select query with the filters included.
The problem with using a select query is you're bypassing a lot of stuff that the proxy needs to do on the returned results, and you're losing the possibility of switching to another proxy in the future.
-
12 Jul 2012 5:18 AM #119
Well I have 2 tables...
Artist Table and Track Table...
So I hope I can do a query to get all tracks from an artist or something.
I'm still trying to understand Sencha as such, so this SQLite isn't that easy for me to understand :-)
But sooner or later I will have to do sth like this here and I thought I'd do this with a SELECT:
http://stackoverflow.com/questions/7...t-foreign-keys
-
12 Jul 2012 10:57 PM #120
Is there support for associations?
Or how can you make SQL statements work, the most common task in sql-environments?
Or should I program this myself, with some javascript?
Or should I use phonegap sqlite plugin to make SQL statements?
There must be foreign keys, primary keys and selects/queries to make sql work like it should work :-)
Whats the best approach?


Reply With Quote