PDA

View Full Version : [CLOSED] Expand get collapsed after message box OK button click



matrixwebtech
Nov 17, 2014, 5:38 AM
Hi,
I need to validate a combo on button click and if not validate then show a message box and combo get expand,but combo collapse after message box ok button click.please see the code.


@(X.ComboBox().ID("combo")
.Items
(
new ListItem("VALUE 1","1"),
new ListItem("VALUE 2","2"),
new ListItem("VALUE 3","3")
)

)
@(X.Button().ID("btn")
.Text("Validate Combo")
.Listeners(l =>
{
l.Click.Handler = @"if(App.combo.getValue()<=0)
{

Ext.Msg.show({
title:'Warning',
msg: 'Select a value from combo.',
buttons: Ext.Msg.OK,
icon: Ext.Msg.INFO
});
App.combo.expand();

}

";
})

)

Daniil
Nov 17, 2014, 3:29 PM
Hi @matrixwebtech,

It is how a ComboBox behaves. It hides it drop down list then something else is clicked.

I would recommend you to consider some other way to notify a problem to a user without leading him to click something. Maybe, the standard validation mechanism.