PDA

View Full Version : Changing the value of a field wont send an "update" it always sends a "create"



Yoda
12 Jul 2010, 6:25 AM
/*
* File: Ext.spmd.Account.ui.js
* Date: Mon Jul 12 2010 21:44:21 GMT-0700 (Pacific Daylight Time)
*
* This file was generated by Ext Designer version xds-1.0.2.0.
* http://www.extjs.com/products/designer/
*
* This file was manually exported.
*/

Ext.spmd.AccountUi = Ext.extend(Ext.Panel, {
title: 'Account Manager',
width: 721,
layout: 'fit',
autoScroll: true,
initComponent: function() {
this.items = [
{
xtype: 'editorgrid',
autoExpandColumn: 'description',
border: false,
id: 'account_grid',
columns: [
{
xtype: 'numbercolumn',
dataIndex: 'code',
header: 'Account ID',
sortable: true,
width: 100,
format: 0,
id: 'code',
editor: {
xtype: 'textfield'
}
},
{
xtype: 'gridcolumn',
dataIndex: 'name',
header: 'Account Name',
sortable: true,
width: 100,
id: 'name',
editor: {
xtype: 'textfield'
}
},
{
xtype: 'gridcolumn',
header: 'Description',
sortable: true,
width: 100,
dataIndex: 'description',
id: 'description',
editor: {
xtype: 'textfield'
}
}
],
bbar: {
xtype: 'paging',
id: 'account_pagingtoolbar',
items: [
{
xtype: 'tbseparator'
},
{
xtype: 'button',
text: 'ADD',
id: 'account_addbutton'
},
{
xtype: 'tbseparator'
},
{
xtype: 'button',
text: 'REMOVE',
id: 'account_removebutton'
},
{
xtype: 'tbfill'
},
{
xtype: 'button',
text: 'SAVE',
id: 'account_savebutton'
},
{
xtype: 'tbseparator'
},
{
xtype: 'button',
text: 'EXIT',
id: 'account_exitbutton'
}
]
}
}
];
Ext.spmd.AccountUi.superclass.initComponent.call(this);
}
});




/*
* File: Ext.spmd.store.AccountStore.ui.js
* Date: Mon Jul 12 2010 21:44:33 GMT-0700 (Pacific Daylight Time)
*
* This file was generated by Ext Designer version xds-1.0.2.0.
* http://www.extjs.com/products/designer/
*
* This file was manually exported.
*/

Ext.spmd.store.AccountStore = Ext.extend(Ext.data.JsonStore, {
constructor: function(cfg) {
cfg = cfg || {};
Ext.spmd.store.AccountStore.superclass.constructor.call(this, Ext.apply({
storeId: 'account',
root: 'data',
sortField: 'code',
autoLoad: true,
remoteSort: true,
api: {
read: '../../index.php/account/read',
update: '../../index.php/account/update',
create: '../../index.php/account/create',
destroy: '../../index.php/account/destroy'
},
baseParams: {
passcode: 'account'
},
writer: new Ext.data.JsonWriter({
encode: true,
writeAllFields: true
}),
fields: [
{
name: 'code'
},
{
name: 'name'
},
{
name: 'description'
}
]
}, cfg));
}
});
new Ext.spmd.store.AccountStore();
Ext.spmd.activator.Account = function() {
//retrieve the store
var account_store = Ext.StoreMgr.lookup('account');

//check if an instance of the account manager panel already exist, if it doesnt...create a new one
if(!Ext.spmd.activator.AccountAttributes.AccountEditor) {
Ext.spmd.activator.AccountAttributes.AccountEditor = new Ext.spmd.AccountUi();
Ext.getCmp('account_grid').reconfigure(account_store,Ext.getCmp('account_grid').getColumnModel());
}
//bind the listeners

//bind the store
Ext.getCmp('account_pagingtoolbar').bindStore(account_store);

//add the panel to the container
Ext.getCmp('index_tabpanel').add(Ext.spmd.activator.AccountAttributes.AccountEditor);
};

Ext.namespace('Ext.spmd.activator.AccountMethods');
Ext.namespace('Ext.spmd.activator.AccountAttributes');

//pointer to the single instance of the grid
Ext.spmd.activator.AccountAttributes.AccountEditor = null;








when i change the value of a field....

instead of an "update" .....a "create" url is called in the background.

Yoda needs help TT___TT

http://sphotos.ak.fbcdn.net/hphotos-ak-snc4/hs185.snc4/37568_136306909723927_100000338553440_240295_5378434_n.jpg

Yoda
12 Jul 2010, 6:31 AM
*bump*

Condor
12 Jul 2010, 6:53 AM
This can only work if you configure an idProperty in the store (reader).

Yoda
12 Jul 2010, 7:02 AM
ohhh......how stupid of me. tnx for saving my life.

markjlyon
16 Aug 2010, 11:47 AM
I also have this problem. Creating a Store (Reader) idProperty does NOT solve this problem. I have my JsonReader with the idProperty and it correctly matches my Json result but it doesn't resolve this issue.

What did you do that actually fixed the problem?