-
Submit grid store
I have a form with 3 editable grids, i want to submit the Ext.data.Store into .php file. What should i do? here is the code
[PHP]Ext.onReady(function()
{
function formatDate(value){
return value ? value.dateFormat('M d, Y') : '';
}
;
var fm = Ext.form;
sm = new Ext.grid.RowSelectionModel();
var cm = new Ext.grid.ColumnModel([{
id:'chname',
header: "
-
Are you needing to submit all the data at once, or after each cell edit?
You might want to check out this tutorial to get a feel for grid editing, however it can be quite overwhelming.
http://extjs.com/learn/Tutorial:Ext2...itor_PHP_MySQL
-
i want to submit all information at once.even if information not change.
-
And how would you like your data that is send to the server to be formatted?
-
i got 3 grids and i want 3 requests to diffirent php scripts
-
i just want to see simple example how can i submit data.store, and sorry for my english:">
-
I think something like this should work (never tried it with XML data though)
Inside your button handler...
Code:
form1.getForm().submit({
params: {
data: Ext.util.JSON.encode(grid.getStore().reader.jsonData)
}
...
});
Its likely that you will have to commit changes to the store before hand, or perform some other actions, but this should get you headed in the right direction.
If you want to submit XML data instead of JSON, then im not sure what you need to do - personally I never use XML data.
-
Example (simply JSON encode the records):
Code:
Ext.Ajax.request({
url: 'submit.php',
method: 'POST',
params: Ext.encode(grid.getStore().getRange()),
callback: function(options, success, response) {
// do stuff
}
});
-
-
Code:
Ext.encode(grid.getStore().getRange());
Does not work for me, i get the following error:
too much recursion ?!
:-?