- if (this.encode === true) { // <-- @deprecated returnJson
- if (Ext.isArray(rs) && data[this.meta.idProperty]) {
- params[this.meta.idProperty] = Ext.encode(params[this.meta.idProperty]);
- }
- params[this.meta.root] = Ext.encode(params[this.meta.root]);
+ /**
+ * <p>This method should not need to be called by application code, however it may be useful on occasion to
+ * override it, or augment it with an {@link Function#createInterceptor interceptor} or {@link Function#createSequence sequence}.</p>
+ * <p>The provided implementation encodes the serialized data representing the Store's modified Records into the Ajax request's
+ * <code>params</code> according to the <code>{@link #encode}</code> setting.</p>
+ * @param {Object} Ajax request params object to write into.
+ * @param {Object} baseParams as defined by {@link Ext.data.Store#baseParams}. The baseParms must be encoded by the extending class, eg: {@link Ext.data.JsonWriter}, {@link Ext.data.XmlWriter}.
+ * @param {Object/Object[]} data Data object representing the serialized modified records from the Store. May be either a single object,
+ * or an Array of objects - user implementations must handle both cases.
+ */
+ render : function(params, baseParams, data) {
+ if (this.encode === true) {
+ // Encode here now.
+ Ext.apply(params, baseParams);
+ params[this.meta.root] = Ext.encode(data);
+ } else {
+ // defer encoding for some other layer, probably in {@link Ext.Ajax#request}. Place everything into "jsonData" key.
+ var jdata = Ext.apply({}, baseParams);
+ jdata[this.meta.root] = data;
+ params.jsonData = jdata;