vmadman
25 Sep 2009, 4:12 PM
Argg, pulling my hair out over here!
I have a store attached to a grid and the data loads like magic. However, all attempts to get the data to save fail!
I've tried setting the store to autoSave, I try to force a .save() on the store, nothing seems to result in a request going out (according to firebug).
Here is some of my code.. help would be much appreciated...
// DATA STORE
store[1] = new Ext.data.Store({
id: 'store_1',
proxy: new Ext.data.HttpProxy({
url: "api/ajax.php?type=competition&subtype=stats&filter=general&filter2=" + jQuery(document).getUrlParam("season") + "&attach=" + jQuery(document).getUrlParam("game")
}),
reader: new Ext.data.JsonReader({
successProperty: 'success',
idProperty: 'number',
root: 'data'
},
[
{name: 'number', allowBlank: false },
{name: 'lastname', allowBlank: false },
{name: 'firstname', allowBlank: false },
{name: 'jersey', allowBlank: false },
{name: 'position', allowBlank: false },
{name: 'played', allowBlank: false },
{name: 'started', allowBlank: false }
]),
writer: new Ext.data.JsonWriter({
encode: false
}),
autoLoad: true,
listeners: {
write : function(store, action, result, res, rs) {
alert("Woo");
},
exception : function(proxy, type, action, options, res, arg) {
if (type === 'remote') {
Ext.Msg.show({
title: 'REMOTE EXCEPTION',
msg: res.message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
}
}
}
});
// GRID
grid[1] = new Ext.grid.EditorGridPanel({
store: store[1],
clicksToEdit: 1,
columns: [
{
id:'lastname',
header: 'Last Name',
width: 80,
sortable: true,
dataIndex: 'lastname',
tooltip: ''
},
{
id:'firstname',
header: 'First Name',
width: 80,
sortable: true,
dataIndex: 'firstname',
tooltip: ''
},
{
id:'passcmp',
header: 'CMP',
width: 50,
sortable: true,
dataIndex: 'passcmp',
tooltip: 'Completions',
editor: new Ext.form.TextField({
allowBlank: true,
tooltip: 'example tip',
listeners: {
render:function(c) {
Ext.QuickTips.register({
target:c,
text:'Completions'
})
}
}
})
},
],
stripeRows: true,
height:350,
width:660,
title:'Basic Information'
});
Since my extJS code is php generated it took me a while to acquire and properly format the source provided above. For that reason and other reasons, there may be parse errors in the code.
I have a store attached to a grid and the data loads like magic. However, all attempts to get the data to save fail!
I've tried setting the store to autoSave, I try to force a .save() on the store, nothing seems to result in a request going out (according to firebug).
Here is some of my code.. help would be much appreciated...
// DATA STORE
store[1] = new Ext.data.Store({
id: 'store_1',
proxy: new Ext.data.HttpProxy({
url: "api/ajax.php?type=competition&subtype=stats&filter=general&filter2=" + jQuery(document).getUrlParam("season") + "&attach=" + jQuery(document).getUrlParam("game")
}),
reader: new Ext.data.JsonReader({
successProperty: 'success',
idProperty: 'number',
root: 'data'
},
[
{name: 'number', allowBlank: false },
{name: 'lastname', allowBlank: false },
{name: 'firstname', allowBlank: false },
{name: 'jersey', allowBlank: false },
{name: 'position', allowBlank: false },
{name: 'played', allowBlank: false },
{name: 'started', allowBlank: false }
]),
writer: new Ext.data.JsonWriter({
encode: false
}),
autoLoad: true,
listeners: {
write : function(store, action, result, res, rs) {
alert("Woo");
},
exception : function(proxy, type, action, options, res, arg) {
if (type === 'remote') {
Ext.Msg.show({
title: 'REMOTE EXCEPTION',
msg: res.message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
}
}
}
});
// GRID
grid[1] = new Ext.grid.EditorGridPanel({
store: store[1],
clicksToEdit: 1,
columns: [
{
id:'lastname',
header: 'Last Name',
width: 80,
sortable: true,
dataIndex: 'lastname',
tooltip: ''
},
{
id:'firstname',
header: 'First Name',
width: 80,
sortable: true,
dataIndex: 'firstname',
tooltip: ''
},
{
id:'passcmp',
header: 'CMP',
width: 50,
sortable: true,
dataIndex: 'passcmp',
tooltip: 'Completions',
editor: new Ext.form.TextField({
allowBlank: true,
tooltip: 'example tip',
listeners: {
render:function(c) {
Ext.QuickTips.register({
target:c,
text:'Completions'
})
}
}
})
},
],
stripeRows: true,
height:350,
width:660,
title:'Basic Information'
});
Since my extJS code is php generated it took me a while to acquire and properly format the source provided above. For that reason and other reasons, there may be parse errors in the code.