PDA

View Full Version : BasicDialog.show(grid cell)?



johnr
21 Jun 2007, 7:15 AM
I'm getting acquainted with BasicDialog, but I'm having a problem. I'd like to have my dialog animation occur from a cell within my grid when I click it, but I'm not sure how to pass that information into BasicDialog.show(). Does anyone have any ideas?



function SummaryTable() {
this.ds = new Ext.data.Store({...});
this.ds.load();
this.colModel = new Ext.grid.ColumnModel([...]);

this.grid = new Ext.grid.Grid('summaryGrid', {
ds: this.ds, cm: this.colModel
});
this.grid.on('cellclick', function(grid, row, col, e) {
myDialog.showDialog(/*** How can I pass the contents of my cell... ***/);
});

this.layout = Ext.BorderLayout.create({...}, 'summaryPanel');
this.grid.render();
}

var myDialog = function() {
var dialog;
return {
init : function() {...},
showDialog : function(myElement) {
if(!dialog){
dialog = new Ext.BasicDialog("myDialog", {
width:800,
height:600
});
dialog.addKeyListener(27, dialog.hide, dialog);
dialog.addButton('Close', dialog.hide, dialog);
}
/*** ...to be used to have the dialog expand animation begin at my cell? ***/
dialog.show(myElement);
}
};
}();

var st;
Ext.onReady(
function() { st = new SummaryTable(); }
);

tryanDLS
21 Jun 2007, 7:25 AM
Use the eventObject passed to your handler. http://extjs.com/deploy/ext-1.1-beta1/docs/output/Ext.EventObject.html#getTarget

johnr
21 Jun 2007, 10:05 AM
Works great, thanks for the pointer!