PDA

View Full Version : Accessing params to current grid's datasource url?



lemontree
22 May 2007, 6:05 AM
Hi,

Is there an easy way to access the url that generated the data for the current page of data on the grid? Including the start, limit, baseParams, sort, and dir? I want to call the script that generated the xml or json for what's currently in view, but instead have it generate a printable html view of the current data in the grid, in a new window...

How can I access that current url?

Thanks,

Matt

tryanDLS
22 May 2007, 7:40 AM
You'll have to navigate thru the object properties. Not tested, but something like

grid.getDataSource().proxy.getConnection().url

joxan
22 May 2007, 9:01 AM
Hi frinds,

i am in trouble with grid related issue....

I am trying to show my grid in my center grid panel , When i submit my search page which is in west panel inside an iframe..i am not able to pass parameters from my iframe to its parent panel.so that i am not able to generate grid.

the control flow i am following is correct or not i am not sure about that. plese i need some help

here is my thread http://extjs.com/forum/showthread.php?t=6312
joxan

lemontree
22 May 2007, 9:27 AM
You'll have to navigate thru the object properties. Not tested, but something like

grid.getDataSource().proxy.getConnection().url

Thanks. That works in that it gives me the url with no parameters, eg "/cgi/script.pl?" ..

Any idea if there is something like grid.getDataSource().proxy.getConnection().params ?

I'm looking but haven't found anything yet..

Matt

tryanDLS
22 May 2007, 10:19 AM
params aren't stored as a property of the connection - they're just passed to the request fn with the options object. The store object has a property baseParams and it also stores the options passed to load as the lastOptions property.

If you needed to access them from the Connection object, you could add a handler for the beforeload event (which gets params as an arg) and store them as a property of the Connection object.

lemontree
22 May 2007, 11:23 AM
params aren't stored as a property of the connection - they're just passed to the request fn with the options object. The store object has a property baseParams and it also stores the options passed to load as the lastOptions property.

If you needed to access them from the Connection object, you could add a handler for the beforeload event (which gets params as an arg) and store them as a property of the Connection object.

I don't need access specifically from the Connection object, I'll take it from anywhere I can get it. I'm adding a button to the toolbar and need to access to the same cgi parameters that were used to get the xml data from the script which gave the data for the current grid. BaseParams, paging params, and all.

Can I get this from the data Store using lastOptions, then?

Thanks,

Matt

lemontree
22 May 2007, 11:31 AM
I don't need access specifically from the Connection object, I'll take it from anywhere I can get it. I'm adding a button to the toolbar and need to access to the same cgi parameters that were used to get the xml data from the script which gave the data for the current grid. BaseParams, paging params, and all.

Can I get this from the data Store using lastOptions, then?

Thanks,

Matt

Ok, I think you pointed me in the right direction..

I can get the url from:
grid.getDataSource().proxy.getConnection.url

I can get the rest of the params (limit, start, sort, dir, custom base ones), for each cgi paramValue, from:
datasource.lastOptions['params'].paramValue

I think that this will do what I need. Thanks again..

Matt