View Full Version : httpproxy with JSON reader how to submit for parms along with ds.load calls?

24 Apr 2007, 9:07 AM
I am using HTTPProxy with a JSON reader to get data for a grid from a server. It woks great and I was able to use the ds config to add additional custom paramaters to each call. Is there a way to also include the rest of the pages form variables in the post? I have a page that renders many other widgets such as text fields etc that need to be sent when I paging/sorting call is made by the grid.

Probably something simple but I was not able to find what I was looking for in the posts or docs. Didn't look hard enough?


24 Apr 2007, 9:59 AM
I don't think there's an Ext wrapper for this yet. You could call YAHOO.util.Connect.setForm('myformid'), which returns a string of name/value pairs.

24 Apr 2007, 11:20 AM
Thanks, But how would I call that and include the text in the stream going to the server by ds.load?

24 Apr 2007, 11:56 AM
You can call that method, store the result in a var and pass that as additional item to the load in params object (similar to how paging passes the start and limit parms)

24 Apr 2007, 2:09 PM
Adding the form parms to the load event worked great.
var iafForm = YAHOO.util.Connect.setForm('iafForm');
ds.load({params:{data: iafForm}});

How would I go about addind in the form parms for all of the grid events e.g. paging, sort etc? I know I could update the Ext code where it does the load but I don't want to touch the source if I don't have to.

thanks again!


24 Apr 2007, 2:26 PM
You could add a handler for the store's beforeload event and do all your processing there - that would get hit every time you load, reagardless of what the reason was.

24 Apr 2007, 2:46 PM
ds.on('beforeload', function() {
ds.baseParams = {data: YAHOO.util.Connect.setForm('iafForm')

worked perfectly.

Thank you tryanDLS!