View Full Version : GridPanel sending parameters in JSON format

12 Jul 2010, 9:05 AM
Problem: With GridPanel there are several parameters that get sent to the server (i.e. dir, sort, limit, filter...). I want to take those parameters and have them get sent over in JSON format.

I am using the HttpProxy and am able to post to the JSON content-type, but the parameters aren't in the right format. They are still in RequestParameter format:


Is there a way to convert this into JSON (some sort of JsonWriter?)?

12 Jul 2010, 11:48 AM

store.on('beforeload', function(store, options){
options.jsonData = options.params;
delete options.params;

13 Jul 2010, 5:47 AM
Thanks for the code!

I messed around with it a bit. For some reason options.jsonData just didn't seem to be storing anything, so I ended up doing:

options.params = Ext.encode(options.params);And that seems to load everything and appear in the body of the request.
The event "beforeload" seems to fire the right times, but the values don't ever seem to account for the "filters" (i.e. the JSON changes when I change how to sort, but when I add a filter onto the grid, there is no JSON that accounts for the new filter). (and yes my filter is remote)

Before I inserted the encoding:

After I inserted the encoding: