JustinHoMi
19 Sep 2007, 9:30 PM
I've been playing with Ext for several days now. I've looked through a lot of the tutorials, blogs, docs, and forum threads and noticed that things seem to change fairly rapidly around here, and much of the info on Grids and inline editing is out of date.
From what I can tell... "OnCellUpdated" has been replaced by Grid.on("afteredit", ...). And DataModel has been replaced by data.store.
Back in the day, there was no function to convert a data.store object to JSON, however now there is Ext.util.JSON, but it only seems to do one record at a time (not an array of records). Is there any convenient way to convert an entire data.store to JSON?
Justin
thejdog
19 Sep 2007, 10:54 PM
I've been playing with Ext for several days now. I've looked through a lot of the tutorials, blogs, docs, and forum threads and noticed that things seem to change fairly rapidly around here, and much of the info on Grids and inline editing is out of date.
From what I can tell... "OnCellUpdated" has been replaced by Grid.on("afteredit", ...). And DataModel has been replaced by data.store.
Back in the day, there was no function to convert a data.store object to JSON, however now there is Ext.util.JSON, but it only seems to do one record at a time (not an array of records). Is there any convenient way to convert an entire data.store to JSON?
Justin
Not fully true, you can't send back a item's object. Like I've tested trying to do a Ext.util.JSON.encode( ugData.data.items ); (datasource being the ugData variable) and that didn't work. But a sample coding I did puting the ugData.data.items[x].data object into a separate array like so, worked perfectly:
ugData.on('load', function () {
var data = ugData.data.items;
var data2 = new Array();
for( var i = 0; i < ugData.getTotalCount(); ++i ) {
data2[i] = ugData.data.items[i].data;
}
Ext.MessageBox.alert('', Ext.util.JSON.encode(data2));
});
It returns with:
[{"id":"4","name":"Administrator"},{"id":"5","name":"Special"},{"id":"1","name":"User"},{"id":"3","name":"Welcome Wagon"}]
So it does work, you just won't be able to send your full data source item object through it. :)
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.