PDA

View Full Version : Exporting a Store's data based on the reader



ZachG
17 May 2010, 12:06 PM
When I have to save the data inside of a store, I have to loop through store.items and save the data for each record in an array. Would it be possible to add something where I could call store.export() and it does the same thing? Basically something like this:



Ext.data.Store.export = function() {
var exportData = [];
this.each(function(inRecord) {
exportData.push(inRecord.data);
});
return exportData;
}


That's the most generic case. Often times I want specific kinds of stores (e.g. Ext.data.JsonStore) to export its data based on the type of store it is (e.g. return exportData as a JSON string).

It would be nice if there was at least an export method for Ext.data.DataReader to simplify the process.