View Full Version : Changing the output of the json writer class

9 Feb 2011, 7:18 PM
I am in the process of reading through the api docs but was wanting to see if anyone can possibly point me in the right direction. Currently, when data is written to the store using the ext.data.jsonwriter class, it places all defined fields in the root property of the ext.data.jsonreader class.

{ 'root' : {'field1' : 'value', 'field2' : 'value', 'field3' : 'value'}

What I need to do is pull some of this data out of the root field and write something similar to the following
{'field1' : value, 'field2' : value, 'root' : {...}}

Here is my configuration:

var proxy = new Ext.data.HttpProxy({
disableCaching: false,
api: {
read: urlRoot+'_design/labcal/_list/normalize/reservations',
create: urlRoot,
update: urlRoot,
destroy: urlRoot

var reader = new Ext.data.JsonReader({
idProperty: Ext.ensible.cal.EventMappings.EventId.mapping || 'id',
root: 'rows',
successProperty: 'ok',
fields: Ext.ensible.cal.EventRecord.prototype.fields.getRange()

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

var store = new Ext.ensible.cal.EventStore({
id: 'event-store',
restful: true,
proxy: proxy,
reader: reader,
writer: writer,
autoLoad: true

Any thoughts or ideas are greatly appreciated.