tomalex0 / senchatouch-v2-sqliteproxy Goto Github PK
View Code? Open in Web Editor NEWSencha Touch Sqlite Proxy compatible for v2
License: MIT License
Sencha Touch Sqlite Proxy compatible for v2
License: MIT License
Sqlite proxy to handle Db operations. This meant to work with Sencha Touch v2 Changes fixed issue in safari 5 and ios 5. fixed , issue with searching based on query. dbConn: Ext.DbConnection.dbConn should be changed to dbConn: Ext.DbConnection Issue mapping property is not working with fields
Destroying record does not work
Some how mapping property in Model is not working as it should .
{
name : 'modifyDateParsed',
type : 'string',
mapping : 'modifyDate', // not working
isTableField : false, //newly implemented to distinguish field
convert : function(value,rec){
var dt = Date.parseDate(rec.get('modifyDate'), "Y-m-d H:i:s")
newval = dt.format('M j, Y, g:i a');
return newval;
}
}
Thanks for sharing this code. Could you please clarify who the copyright holder is and what license it is being released under, thanks.
This implementation have a 5mb data limit, like a WebSQL?
If we have table field name as "id" which is a primary key, we will have to mention a dummy name(not a field in table) as idProperty of model and clientIdProperty as "id". The issue is that default idProperty of model is "id" which will always have value like this "ext-record-x". If mentioned config options are not specified in model, id value in table will be like ext-record-1,2,3. But we expect it as integer.
Example
Ext.define("Contacts", {
extend: "Ext.data.Model",
config : {
idProperty : 'uniqueid', // if we have field with name as id, conflicts happens with default idProperty(id) which always have value as ext-record-x
clientIdProperty : 'id',
fields: [{
name: 'firstName',
type: 'string'
}, {
name: 'lastName',
type: 'string'
},{
name: 'id',
type: 'int',
fieldOption: 'PRIMARY KEY'
}, {
name: 'modifyDate',
type: 'string'
}, {
name: 'modifyDateParsed',
type: 'string',
mapping: 'modifyDate', // not working
isTableField: false,//newly implemented to distinguish field
convert: function(value, rec) {
var dt = Ext.Date.parseDate(rec.get('modifyDate'), "Y-m-d H:i:s")
newval = Ext.Date.format(dt,'M j, Y, g:i a')
return newval;
}
}],
proxy: {
type: 'sqlitestorage',
dbConfig: {
tablename: 'contacts_tables',
dbConn: Ext.DbConnection.dbConn
},
reader: {
type: 'array'
}
}
},
writer: {
type: 'array'
}
});
sencha touch 2 RC
Chrome : ok
Android : ok
Safari (desktop and mobile) :
TypeError: Type error SqliteProxy.js:137
Hi All,
I am using these SqliteStorage Js file and I am hitting an issue when I run it on my safari browser.
I get 'Type issue : undefined is not a object' while evaluating this.config.dbConfig.dbConn.dbConn.
But I put in breakpoints at the getDb function in the js file and found that the dbConn is defined but i am not able to get over this issue. Any pointers could be great.
getDb: function () {
return this.config.dbConfig.dbConn.dbConn
Thank you,
Divya.
Every time i tried to save some field whit the value "0" that value gets set to "NULL".
discountCode N
rate 0
["discountCode"] "fields"
["N"] "values"
The only way i can workaround this is using type string.
discountCode N
rate 0
["discountCode", "rate"] "fields"
["N", "0"] "values"
In the method constructFields you fetch the fields from the model. But not only my model fields got added but these extra fields too:
parentId TEXT,
index INTEGER,
depth INTEGER,
expanded bool,
expandable bool,
checked auto,
leaf bool,
cls TEXT,
iconCls TEXT,
root boolean,
isLast boolean,
isFirst boolean,
allowDrop boolean,
allowDrag boolean,
loaded boolean,
loading boolean,
href TEXT,
hrefTarget TEXT,
qtip TEXT,
qtitle TEXT
This resulted in an error when trying to add a column called index...
I temporary solved this by explicitly setting the 'isTableField: true' parameter and removing the part where it could be undefined.
Line 158:
if(f.config.isTableField || !Ext.isDefined(f.config.isTableField)){
/* ... */
}
I'm not 100% shure but this proxy doesn't support treedata (yet), am I right? I would like to add that support.
You have any idea how to get the hasMany or hasOne properties out?
I got an Event model the event model hasMany 'cost' and hasMany 'participant'
me.getModel().prototype returns the the model and I see cost and costStore, participant and participantStore but can't find an array containing the child objects (ex: ['cost', 'participant'] ).
By any chance we can use real sqlite3 database for SenchaTouch-v2-SqliteProxy?
https://github.com/davibe/Phonegap-SQLitePlugin
I think this can be easily done, by replacing this line ( in SqliteConnection.js):
me.dbConn = openDatabase(me.dbName,me.dbVersion, me.dbDescription, me.dbSize);
to:
me.dbConn = new PGSQLitePlugin("test_native.sqlite3");
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.