View Full Version : Replace local DB with Sencha models?

6 Dec 2010, 8:01 PM
I'm writing an app that will ultimate be released as an iPhone app with PhoneGap. As such everything except the actual data sits client-side. The app itself allows access to information about beers and the breweries that make them.

Right now I'm using the local WebKit SQLite instance to store data locally. It has two tables: one for beers and one for breweries. Those tables are then connected up to the UI with Sencha models and stores, and to the server via a JSON interface. (I need persistent local storage since the app needs to work offline, then sync its data with the server when a connection is available.)

It starts to feel a bit heavy. So I wondered if I could eliminate the database. Sencha models support associations, but the associations here aren't strictly hierarchical. That is, each brewery has a number of beers and each beer belongs to a single brewery...but one can also list beers by how recently they were added or by type of beer (Pale Ale, Stout, etc.), regardless of brewery. Can this be accomplished solely with Sencha models/stores? If so, is there a good example to help me fill in the details?


7 Dec 2010, 2:22 AM
you can sort and filter a beer store by any property of your model

14 Dec 2010, 6:20 AM
Did ya managed to get it work? Working on an iPad app for school, and i basicly want to do the same, users can add stuff to a local database, and when there is connection sync the new items with the serverside database.. But i cant seem to get it right. Do you got any tips?

24 Dec 2010, 12:14 PM
Maybe I can ask this a more specific way. I need a data store that's locally persistent (i.e. uses localStorage or local SQLite), but that also syncs its data with a server-side API (JSON). That is, I initialize it locally, then read from and write to the remote JSON API. When a net connection isn't available it needs to track any local changes for later syncing when a connection becomes available again.

Does Sencha provide something like this?