IndexedDB

by Johan Vandeplas

HTML

<script src="http://cdn.sencha.com/ext/gpl/4.2.1/ext-all-dev.js"></script>
<link rel="stylesheet" href="http://cdn.sencha.com/ext/gpl/4.2.1/resources/css/ext-all.css">

JavaScript

Ext.create('Ext.data.Store', {
    storeId:'simpsonsStore',
    fields:['name', 'email', 'phone'],
    data:{'items':[
        {"name":"Lisa", "email":"[email protected]", "phone":"555-111-1224"},
        {"name":"Bart", "email":"[email protected]", "phone":"555-222-1234"},
        {"name":"Homer", "email":"[email protected]", "phone":"555-222-1244"},
        {"name":"Marge", "email":"[email protected]", "phone":"555-222-1254"}
    ]},
    proxy: {
        type: 'memory',
        reader: {
            type: 'json',
            root: 'items'
        }
    }
});

Ext.create('Ext.grid.Panel', {
    title: 'Simpsons',
    store: Ext.data.StoreManager.lookup('simpsonsStore'),
    columns: [
        {header: 'Name',  dataIndex: 'name', editor: 'textfield', lockable:false, locked:true},
        {header: 'Email', dataIndex: 'email', flex:1,
            editor: {
                xtype: 'textfield',
                allowBlank: false
            }
        },
        {header: 'Phone', dataIndex: 'phone'}
    ],
    selType: 'rowmodel',
    plugins: [
        Ext.create('Ext.grid.plugin.CellEditing', {
            clicksToEdit: 1
        })
    ]
    height: 200,
    width: 400,
    renderTo: Ext.getBody()
});

(function(){     
    // In the following line, you should include the prefixes of implementations you want to test.
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
var IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction;
var IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange;
    
    Ext.define('BCS.data.IndexDb', {
        version: 1,
        requests: [],
        
        constructor: function(cfg){
            var me = this;
            
            Ext.applyIf(me, cfg);
            
            if(me.dbName){
                console.log('OEPS! no database name found!');
            }
            
            
            
      ...