-
12 Sep 2011 7:47 PM #11
@Yoann
I have tried to implement sqliteproxy for sencha touch , you can check it out here. IndexDB not implemented.
http://www.sencha.com/forum/showthre...65-SqliteProxy
-
5 Apr 2012 8:40 PM #12
WebDB proxy not working
WebDB proxy not working
Hello everyone,
I am trying to use the proxy mentioned in the github, but am facing issues. I get an error message that says "getIDProperty of undefined". What am i missing in the code?
Khushbu
Thanks in advance
-
2 May 2012 11:54 AM #13
Ext 4,1 And IndexedDb Proxy
Ext 4,1 And IndexedDb Proxy
Can anyone verify if this still works in 4.1?
-
2 May 2012 12:33 PM #14
Using the IndexedDB Proxy with the MVC Architecture
Using the IndexedDB Proxy with the MVC Architecture
I was receiving the following error when attempting to use this proxy in an app where I was following the MVC architecture.
"Uncaught You are using a ServerProxy but have not supplied it with a url"
I think my problem is that the model has no proxy, and hence the model manager assigned a default proxy with type "Ajax".
My Model
Ext.define('AM.model.User', {
extend: 'Ext.data.Model',
fields: [
{ name: 'id', type: 'int' },
{ name: 'firstName', type: 'string' },
{ name: 'lastName', type: 'string' },
{ name: 'dateOfBirth', type: 'date' },
{ name: 'email', type: 'string' },
{ name: 'testResult', type: 'string' }
],
idProperty: 'id'
});
My Store
Ext.define('AM.store.Users', {
require: ['Ext.data.proxy.IndexedDB', 'Ext.data.proxy.IndexedDB', 'Ext.data.proxy.WebDB'],
extend: 'Ext.data.Store',
// destroy the store if the grid is destroyed
autoDestroy: true,
autoSync: true,
autoLoad: true,
model: 'AM.model.User',
proxy: {
type: 'idb',
dbName: 'users',
objectStoreName: 'user',
dbVersion: '1.0',
writer: {
type: 'json',
writeAllFields: false
},
initialData: [
{
dateOfBirth:"05 January 1970",
email:"pg@fg.com",
firstName:"Peter",
id:1,
lastName:"Griffen",
testResult:"Pass"
}, {
dateOfBirth:"06 January 1970",
email:"sg@fg.com",
firstName:"Stewie",
id:2,
lastName:"Griffen",
testResult:"NotSet"
}
]
}
});
My workaround to get this to work was to copy the proxy from the store into my model object, which is not ideal. i.e my model becomes
Ext.define('AM.store.Users', {
require: ['Ext.data.proxy.IndexedDB', 'Ext.data.proxy.IndexedDB', 'Ext.data.proxy.WebDB'],
extend: 'Ext.data.Store',
// destroy the store if the grid is destroyed
autoDestroy: true,
autoSync: true,
autoLoad: true,
model: 'AM.model.User',
proxy: {
type: 'idb',
dbName: 'users',
objectStoreName: 'user',
dbVersion: '1.0',
writer: {
type: 'json',
writeAllFields: false
},
initialData: [
{
dateOfBirth:"05 January 1970",
email:"pg@fg.com",
firstName:"Peter",
id:1,
lastName:"Griffen",
testResult:"Pass"
}, {
dateOfBirth:"06 January 1970",
email:"sg@fg.com",
firstName:"Stewie",
id:2,
lastName:"Griffen",
testResult:"NotSet"
}
]
}
});
Is there a better solution to this problem? Quite new to ExtJs!!!
-
23 Jan 2013 8:56 AM #15
Can't create a second objectStore in the same DB
Can't create a second objectStore in the same DB
Hello, after all, I'll like to give you credit for this proxy's implementation, it's great.
I'm using ExtJS 4.1
I've created a Model that use BrowserDB proxy (ID
with some InitialData and it works fine, but, when I try to define another Model with a proxy "browserdb" with a diferent objectStoreName, but using the same db, it's not been created, only when I change the dbName property in the configuration, works, but for me doesn't have too much sense...
Please, help...Code:// ****************** Always works ******************** //Model Ext.define('app.model.Customer', { extend: 'Ext.data.Model', fields: [ ... ], proxy : { type : 'browserdb', dbName : 'db1', objectStoreName : 'customer', writer : { type : 'json', writeAllFields : false }, initialData : [{ ... },{ ... } ] } }); // Store... Ext.define('app.store.Customers', { extend : 'Ext.data.Store', autoDestroy: true, autoSync: true, autoload: true, requires: ['app.model.Customer'], config : { model : 'app.model.Customer', storeId : 'Customers' } }); // ***************************************************** // Second Model // ****************** This never works ********************* // Model... Ext.define('app.model.Product', { extend: 'Ext.data.Model', fields: [ ... ], proxy : { type : 'browserdb', dbName : 'db1', objectStoreName : 'products', writer : { type : 'json', writeAllFields : false } } }); //Store... Ext.define('app.store.Products', { extend : 'Ext.data.Store', autoDestroy: true, autoSync: true, autoload: true, requires: ['app.model.Product'], config : { model : 'app.model.Product', storeId : 'Products' } }); // ***************************************************** // Created in another DB // ******************** This works ************************ Ext.define('app.model.Product', { extend: 'Ext.data.Model', fields: [ ... ], proxy : { type : 'browserdb', dbName : 'db2', objectStoreName : 'products', writer : { type : 'json', writeAllFields : false } } }); // ***************************************************** // At last the insertion var store = Ext.create('app.store.Products'); var product = Ext.create('app.model.Product', { ... }); product.save(); store.insert(0,product); store.save();


Reply With Quote