PDA

View Full Version : Stop combo's select event to fire



SabaSarwat
19 Jan 2011, 10:59 PM
Good morning!

I have a combo, on its select event i have showed some fieldsets on the basis of the record selected (Initially these fieldsets are hidden). Here is the code...


select : function(combo, record, index) {
Ext.getCmp('fieldsetA').hide();
Ext.getCmp('fieldsetB').hide();
Ext.getCmp('fieldsetC').hide();

if (index == 0) {
Ext.getCmp('fieldsetA').show();
} else if (index == 1) {
Ext.getCmp('fieldsetA').show();
Ext.getCmp('fieldsetB').show();
} else if (index == 2) {
Ext.getCmp('fieldsetA').show();
Ext.getCmp('fieldsetC').show();
} else if (index == 3) {
Ext.getCmp('fieldsetC').show();
} else if (index == 4) {
} else if (index == 5) {
Ext.getCmp('fieldsetB').show();
Ext.getCmp('fieldsetC').show();
}
}

Changes in selection delete previous saved data and create new row in database. I showed a messagebox to alert the user in beforeselect event. Now i want that if the user selects 'yes', select event should work as it is working but when the user selects 'no', select event should not fire.


beforeselect: function(combo, record, index){
Ext.Msg.show( {
title : 'Do you really want to select accident type?',
buttons : Ext.MessageBox.YESNO,
msg : 'It may result in losing associated form data.',
fn : function(btn) {
if (btn == 'yes') {

}
if (btn == 'no') {

}
}
});
}

I don't know how to achieve this. I would be extremely helpful if someone could show me any direction.
waiting...

vishalnnsingh
20 Jan 2011, 12:29 AM
if (btn == 'yes') {
combo.setValue(rec.getAt(index))
}
if (btn == 'no') {
return false;
}
try this out, i hope it will work

SabaSarwat
20 Jan 2011, 12:38 AM
Alas! Its not working.
During the message box appears. At back select event fires and my fieldsets show up before i select yes or no in message box.