View Full Version : Submit Whole Grid

10 Aug 2010, 2:42 AM
hi, i have a grid which is formed only at client side (i.e. nothing is read from server). After pressing the button I need this whole grid (store) to be somehow submitted to the server php script. How to set up such behaviour?

Now i have such script but it's not working:

var myData = [
['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am'],
['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],
['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am']

var writer = new Ext.data.JsonWriter({
encode: false

var proxy = new Ext.data.HttpProxy({
url: 'ajax3.php'

var store = new Ext.data.ArrayStore({
fields: [
{name: 'company'},
{name: 'price', type: 'float'},
{name: 'change', type: 'float'},
{name: 'pctChange', type: 'float'},
{name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
proxy: proxy,
writer: writer,
autoSave: true


var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{id:'company',header: 'Company', width: 160, sortable: true, dataIndex: 'company'},
{header: 'Price', width: 75, sortable: true, dataIndex: 'price'},
{header: '% Change', width: 75, sortable: true, dataIndex: 'pctChange'},
{header: 'Last Updated', width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
stripeRows: true,
autoExpandColumn: 'company',
height: 350,
title: 'Array Grid'


buttons: [{
text: 'Save',
handler: function (b,e){

Thanks in advance for help

10 Aug 2010, 9:01 AM
i saw examples of CRUD stores with both read and write from server-side script, but i need only write (and no c,r,u,d, just a batch "C")

10 Aug 2010, 10:25 AM
loop through the store, and generate your list of items and submit them with an ajax request.

10 Aug 2010, 12:51 PM
loop through the store, and generate your list of items and submit them with an ajax request.
thanks jgarcia for your reply,
i was digging too much into readers/writers stuff and didn't thought about this simple, yet effective solution :)

now it really works

10 Aug 2010, 9:32 PM
Well you need "R" to load the grid.

"C" and "D" are optional. Don't create new records and don't delete any!