PDA

View Full Version : Ext.Window Callback



avsomeren
25 Jul 2009, 11:58 PM
Hi all,

I have been locking into getting some results from a custom dialog window. Unfortionately i have not been able to get this right.

The case is that after a inter-grid DD operation, a small dialog, which contains 2 date fields, is launched inside the notifyDrop event .

For some reason i'm have troubles returning those values at the point i launched the window.




// The Dialog
DaCapo.Admin.Components.DateSpanInputDialog = function(config)
{
Ext.applyIf(this, config);
this.items = [
new Ext.FormPanel({
labelWidth: 90,
defaultType: 'textfield',
id: 'timespanform',
url: 'Product/AddOffer',
bodyStyle: 'padding: 5px 5px 0',
items: [{
xtype: 'fieldset',
autoHeight: true,
defaultType: 'textfield',
items: [{
name: 'startdt',
fieldLabel: 'Geldig van',
xtype: 'datefield',
ref: '/StartDate',
endDateField: 'enddt',
value: new Date()
}, {
name: 'enddt',
fieldLabel: 'Geldig tot',
xtype: 'datefield',
ref: '/EndDate',
startDateField: 'startdt',
value: new Date().add(Date.MONTH, 1)
}]
}]
})
];


DaCapo.Admin.Components.DateSpanInputDialog.superclass.constructor.call(this,
{
title: this.title,
closable: true,
id: 'timespandlg',
width: 350,
autoHeight: true,
resizable: false,
plain: true,
modal: true,
title: 'Bestand toevoegen',
animateTarget: this.animateTarget,
buttons: [{
text: 'Ok',
handler: function() {
Ext.getCmp('timespandlg').close();
}
}, {
text: 'Annuleren',
handler: function() {
Ext.getCmp('timespandlg').close();
}
}]
});
}

Ext.extend(DaCapo.Admin.Components.DateSpanInputDialog, Ext.Window);


// In code i am calling

var dlg = DaCapo.Admin.Components.DateSpanInputDialog();
dlg.show({
fn: function()
{
// How to get the return values from the dialog at this point..
}
});


P.S. : I created a quick mockup of the original code

avsomeren
26 Jul 2009, 1:13 AM
What a good nights sleep can do to a human being ;)

I solved it by passing scope and getting the values by ref from the dialog. A shame is spent 2+ hours last night tearing out the few hairs i have left..