PDA

View Full Version : Get Json from GridPanel DataStore



taxidriver
12 Nov 2010, 10:35 AM
Hello guys,

i would like to send back to the server and save all the data in a form including detail gridpanels and simple form fields (like text boxes, date fields, text areas and so on).
i would like this to happen in a single ajax request call, so that everything fails or commits (instead of each datastore performing its own save call).
i was thinking about creating a single json which will contain all the smaller jsons from all the detail grids, form fields and so on.
is there any simple way to get the json of only the gridpanel's datastore modified records or if this is not possible, the json for all the data of a gridpanel's datastore ? (so that i will use it to sum up all the small jsons in one)

Screamy
12 Nov 2010, 11:48 AM
To get only the modified records from a Grid's store:


var modifiedRecords = Ext.getCmp('myGrid').store.getModifiedRecords()I'm not sure if there's any sort of method call or property which will give you a block of JSON for the entire set of records, but you can get the JSON from an individual record. Below, I get the JSON for the first record in the set:


modifiedRecords[0].json