PDA

View Full Version : Querying beyond ownerCt?



davidryan
15 Feb 2012, 10:50 AM
Hi there,

The scenario:

1. Grid with a button.
2. Button event, window created.
3. Save button in window, I want to get the original grid as part of the controller handling the button[text=Save] click event.

I thought I could walk up ownerCt and down, but ownerCt stops at Window. Is it possible to find the calling container (in this case the grid) of the Window without using id's, itemId's, ref's, etc.?

mitchellsimoens
15 Feb 2012, 10:53 AM
I usually simple put a reference of the grid onto the window.

davidryan
15 Feb 2012, 11:21 AM
Are you suggesting I do something like:



// ownerCt of this is the grid
displayFunction: function(btn) {
var callerId = btn.up('grid').id;

var view = Ext.create('...',{callerId:callerId});
...
}

// ownerCt of this is the window
saveFunction: function(btn) {
var callerId = '#' + btn.up('window').id;
var callerGrid = Ext.ComponentQuery.query(callerId);
}


Or could you recommend something cleaner? I've just tried this and it appears to dump the object correctly.

Thanks for the quick response!