View Full Version : store.save() not updating data for existing record

9 Nov 2011, 7:34 AM

I am testing my Sencha Touch 1.1 form in Chrome on Mac and store.save() is not saving changes to existing records. The same code saves new records just fine. I am using sqlitestorage as my proxy. Any help would be greatly appreciated.

Here's what my form's listener code looks like:

listeners: { 'tap': function() {
// Save Record

var mainform = app.views.accountForm;
var formval = mainform.getValues();

if(!Ext.isEmpty(formval.username) && !Ext.isEmpty(formval.password)){
// save AccountType.Name in the Account.Name field for later use
var accountTypeId = parseInt(formval.accountTypeId);
var accountType = app.stores.accounttypes.getById(accountTypeId);

if(accountType != null)
this.record.set('name', accountType.get('name'));

this.form.updateRecord(this.record, true);

// re-load the list or the new record won't be reflected

} else {
alert("Enter Values");

controller: app.controllers.accounts,
action: 'index'

Here's my model code:

app.models.Account = Ext.regModel("app.models.Account", { fields: [
{ name: "id", type: "int", fieldOption: 'PRIMARY KEY ASC' },
{ name: "accountTypeId", type: "int" },
{ name: "name", type: "string" },
{ name: "username", type: "string" },
{ name: "password", type: "string" },
{name: "isDefault", type: "boolean"}
proxy: {
type: 'sqlitestorage',
dbConfig: {
tablename: 'accounts_tables',
dbConn: Ext.DbConnection.dbConn
writer: {
type: 'json'

Thanks again!

10 Nov 2011, 5:47 AM
I would suggest asking help from the proxy author.

14 Nov 2011, 11:46 AM
thanks for the reply. I asked the plugin creator and he showed me what I was doing wrong.