PDA

View Full Version : Trouble catching parameter in a new component window



sajan
6 Jul 2010, 12:11 AM
Hi all, I am having little problem with new component
Lets called Grid 1 (as parent Grid) and Grid 2 (as child Grid)
1. I have a grid- Grid 1
2. Double clicking a row on a Grid 1 opens a new window which also has a Grid -Grid 2
3. I have to pass parameter from Grid 1 to a new window opened by double click event. And I am stuck where to write this one on the JS not the ui.js file for new component. If yes how?
4. The passed parameter from Grid 1 to the Grid 2 in New window is the ID value
6. This ID also has to update the Grid 2 Store's url. So how to do that?

In summary
1. How to pass parameter from 1 component to another
2. How to update the Store's URL on the fly
Please help me on this
thanks

sajan
6 Jul 2010, 3:20 AM
I was able to send data and it is showing in Firebug too but how to catch them?

var win = new QuoteLineWindow(this.TenderGrid,'Update Tender','edit',QuoteID);
win.show();

This is my new Window which contains the Grid

QuoteLineWindow = Ext.extend(QuoteLineWindowUi, {
initComponent: function() {
QuoteLineWindow.superclass.initComponent.call(this);

this.QuoteLineGrid.store.load(QuoteID)
}
});
Please help how to catch the sent parameters
thanks

jarrednicholls
6 Jul 2010, 5:29 AM
Hi sajan,

how about this?

Double Click Handler


var win = new QuoteLineWindow({
QuoteID: QuoteID
});
win.show();




QuoteLineWindow = Ext.extend(QuoteLineWindowUi, {
initComponent: function() {
QuoteLineWindow.superclass.initComponent.call(this);

this.QuoteLineGrid.store.load({
params: {
QuoteID: this.QuoteID
}
});
}
});


In general, component constructors take a "config" object, which is then applied to the instance of the component. So I passed { QuoteID: <...> }, and QuoteID is applied to the QuoteLineWindow instance and is thus available in "initComponent" by specifying "this.QuoteID". As far as the store's load method, it can take a "params" configuration, which are parameters that are sent with the http request. I added QuoteID to the parameter list...but it can be named anything, e.g., params: { qid: this.QuoteID }

Hope that helps.

sajan
6 Jul 2010, 6:45 AM
Thanks Jarred,
Yes It did work .
Sending it as parameter. But it would have been great if I can append it directly to URI(We usually do it this way. But then also it is fine )

but Now I faced another problem. The list is not refreshing correctly.
Do I have to destroy the store if the window is closed?

sajan
6 Jul 2010, 6:46 AM
and sometimes it is not running the double click function.

thanks