-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
- Line 339 in the destroy method looks like it should be removed
- Line 340 looks like the false parameter can be removed (although it causes no harm)
- setRecord's onSuccess callback should update the record id based on value from database if was not set, as follows:
setRecord: function(record) {
var me = this,
rawData = record.data,
fields = [],
values = [],
placeholders = [],
onSuccess = function(tx,rs,record) {
if (me.insertingInitialData) {
me.initialDataCount--;
if (me.initialDataCount === 0) {
me.insertingInitialData = false;
me.fireEvent('initialDataInserted');
}
}
// If record source did not have an id, then that means
// the database just generated one. So we'll update the
// record now.
if(typeof record.get('id') == 'undefined'){
record.internalId = rs.insertId;
record.data.id = rs.insertId;
}
};
//extract data to be inserted
for (var i in rawData) {
fields.push('"'+i+'"');
values.push(rawData[i]);
placeholders.push('?');
}
me.db.transaction(function(tx){
tx.executeSql('INSERT INTO ' + me.dbTable+'('+fields.join(',')+') VALUES ('+placeholders.join(',')+')',
values,
Ext.bind(onSuccess, me, [record], true), //on success
Ext.bind(me.onError, me)); // on error
});
return true;
},Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels