View Full Version : [OPEN-1456] Store's write event won't fire - problem is metaData?

6 Dec 2010, 4:46 PM
Hi - I've been having trouble getting the "write" event to fire when doing a create operation. I seem to have solved the problem by specifying "fields", "totalProperty", "idProperty" and "root" in the store - I had been generating all of those server-side via "metaData". Does anyone know if it is indeed true that you must specify those statically (not loaded via metaData) to get "write" to fire?

Adding those items in the store definition was the only thing I changed, and it seems to work fine, but I would prefer to use metaData server-side.

Thanks for your help.

7 Dec 2010, 12:44 AM
I would consider this a bug.

Would you like me to move this to the Bugs section (you will have to provide an stand-alone example that demonstrates the issue)?

7 Dec 2010, 5:01 AM
Will do Condor - thank you very much.

3 Feb 2011, 2:38 PM
This one just bit me again and I realize I didn't provide an example on it - here it is:

win2.ContribLimitsStore = function(p){

var store = new Ext.data.JsonStore({
"fields": ['id','employer','amount','currentamount'],

autoLoad : true,
autoSave: true,
proxy: new Ext.data.HttpProxy({
api: {
read : '/contribution/limit/s_index',
create : '/contribution/limit/create_do',
update : '/contribution/limit/edit_do',
destroy : '/contribution/limit/delete_do'
writer: new Ext.data.JsonWriter({
returnJson: true,
writeAllFields: false
listeners: {
'exception': function(proxy, type, action, options, response){
alert('Exception - ' + type + ' - ' + action);


return store;


win2.ContribLimitsGrid = Ext.extend(Ext.grid.EditorGridPanel,{

loadMask: true,

height: 600,

stripeRows: true,

id: 'contriblimitsgrid',

frame : true,

title : 'Contrib Limits',

initComponent : function(){

var grid = this;

Ext.apply(this,{store : new win2.ContribLimitsStore(),

cm : new Ext.grid.ColumnModel([{

header: 'Employer',

sortable: true,

dataIndex: 'employer',
editor: new Ext.form.TextField


header : 'Limit',

sortable : true,

dataIndex : 'amount',
editor: new Ext.form.TextField


header : 'Current Amount',

sortable : true,

dataIndex : 'currentamount'


sm : new Ext.grid.CheckboxSelectionModel(),


if (grid.mode != 'dashboard') {
Ext.apply(this,{tbar: [{
text: 'New',
handler: function(){
var Limit = grid.getStore().recordType;
var p = new Limit({
employer: '',
amount: 1500
// grid.stopEditing();
grid.store.insert(0, p);
// grid.store.commitChanges();
// grid.startEditing(0, 0);
text: 'Delete',
handler: function(){
var rec = grid.getSelectionModel().getSelected();




As written, the read function on the store would consume the following json:

{"success":true,"totalCount":1,"metaData":{"fields":["currentamount","to","amount","from","id","actid","employer"],"totalProperty":"totalCount","autoLoad":true,"idProperty":"id","root":"result"},"result":[{"currentamount":"500.00","to":"0000-00-00","amount":"2500","from":"0000-00-00","id":"7","actid":"1","employer":"Jones Day"}]}

With this code, adding a new row will result in an exception. However, by adding the fields:

"fields": ['id','employer','amount','currentamount'],

in the store directly (not through metaData), everything works great.

It is entirely possible I am making a mistake somewhere, so please don't hesitate to point it out.

If I can be helpful in any other way, please do not hesitate to ask. Thanks,