Skip to content

shepsii/extjs-db-proxies

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

extjs-db-proxies

WebSQL/SQLite, IndexedDB and dynamic proxies for ExtJS

sql proxy: dynamically switches to websql or sqlite if the cordova plugin is found indexeddb: tested in chrome, safari and firefox. IE testing to come (although openCursor in place of getAll is working) dynamic: will automatically select sql or indexeddb, in the order you specify, based on support

--HOW TO USE--

If you are a git guru, you may know how to clone only the package from this repository into an application's packages/local directory.

If I just described you, please let me know how to do that so I can update these instructions accordingly!

Otherwise...

  1. Add the dependency to your app's package.json file:
"dependencies": {
    "extjs-db-proxies": "git+ssh://git@github.com/shepsii/extjs-db-proxies.git"
  }
  1. run npm install (you will need nodejs installed)
  2. create a symlink in packages/local (this works for linux/mac; windows guys you'll need to work this one out on your own)
cd packages/local;
ln -s ../node_modules/extjs-db-proxies/packages/local/dbproxies dbproxies
  1. Add to the requires in your app.json:
"requires": [
        "dbproxies"
]

(4b. if you have any other packages that need to use the proxies, they will also need to require the package)

  1. Require in the proxy you need from a model or store class, and set the proxy using e.g. type: 'sql' or see below for an example of the use of the dynamic proxy:
Ext.define('MyApp.model.Person', {
    extend: 'Ext.data.Model',

    requires: [
        'DBProxies.data.proxy.Sql',
        ...
    ],
    proxy: {
        type: 'dynamic',
        allConfig: {
            cloud: false
        },
        proxies: [
            {
                type: 'sql'
            },
            {
                type: 'indexeddb'
            }
        ]
    },
    ...
  1. Optionally, override the DBProxies.config.Config class to change the database name, description and size, e.g.:
Ext.define('MyApp.overrides.dbproxies.Config', {
    override: 'DBProxies.config.Config',

    dbName: 'myappdb',
    dbDescription: 'This is my db description',
    dbVersion: '1.0',
    dbSize: 5000000
    
});

You should then be good to go - if not, throw out a sencha app refresh and then try another sencha app watch. Before you go crazy on these, make sure a sencha app build works too.

Please feel free to fork and pull request any changes.

About

WebSQL/SQLite and IndexedDB proxies for ExtJS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published