PDA

View Full Version : Error in Combobox: all items removed after selection



jalal_omary
2 Sep 2009, 9:05 PM
Hi,

A problem faced me today in form combobox, after making selection from the combo all items are removed and i can't change my selection after that, please if anyone know the reason tell me.

Here is the code


Ext.ns('Global');
Global.Languages = new Ext.data.SimpleStore({
fields: ['LanguageID', 'Title'],
data : [
['1','English'],
['3','Franšais'],
['4','Deutsch'],
['5','Italiano'],
['6','Espa˝ol'],
['7','???????'],
]
});
Global.Form = Ext.extend(Ext.form.FormPanel, {
border: false,
frame: true,
labelWidth: 100,
url: '/User/SignUp',
initComponent: function () {
var config = {
defaultType: 'textfield',
defaults: {
anchor: '-24'
},
items: [{
name: 'Name',
fieldLabel: 'First Name',
allowBlank: false,
xtype: 'textfield',
anchor: '95%'
},
{
name: 'LastName',
fieldLabel: 'Last Name',
allowBlank: false,
xtype: 'textfield',
anchor: '95%'
},
{
name: 'Email',
fieldLabel: 'Email',
vtype: 'email',
allowBlank: false,
xtype: 'textfield',
anchor: '95%'
},
{
name: 'Password',
fieldLabel: 'Password',
inputType: 'password',
allowBlank: false,
xtype: 'textfield',
anchor: '95%'
},{
xtype: 'combo',
name: 'LanguageID',
fieldLabel: 'Language',
allowBlank: false,
mode: 'local',
lazyRender:false,
store: Global.Languages,
displayField:'Title',
width: 120
}],
buttons: [{
text: 'Submit',
formBind: true,
scope: this,
handler: this.submit
}]
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
Global.Form.superclass.initComponent.apply(this, arguments);
}
,
onRender: function () {
Global.Form.superclass.onRender.apply(this, arguments);
this.getForm().waitMsgTarget = this.getEl();
},
submit: function () {
this.getForm().submit({
url: this.url,
scope: this,
success: this.onSuccess,
params: {
cmd: 'save'
},
waitMsg: 'Saving...'
});
},
onSuccess: function (form, action) {
Ext.Msg.show({
title: 'Success',
msg: 'User Added successfully',
modal: true,
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
}, closeSignUpWindow());
},
showError: function (msg, title) {
title = title || 'Error';
Ext.Msg.show({
title: title,
msg: msg,
modal: true,
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
});
function closeSignUpWindow(btn){
Ext.getCmp('SignUpWindowID').hide()
};

Ext.reg('SignUpForm', Global.Form);

Ext.onReady(function () {

Ext.QuickTips.init();

// invalid markers to sides
Ext.form.Field.prototype.msgTarget = 'side';

// create and show window
var win = new Ext.Window({
title: 'New User',
id: 'SignUpWindowID',
width: 600,
height: 230,
minWidth: 300,
minHeight: 230,
plain: true,
buttonAlign: 'center',
modal: true,
resizable: false,
closeAction: 'hide',
draggable: false,
layout: 'fit',
items: {
id: 'SignUpFormID',
xtype: 'SignUpForm'
}
});
});

jalal_omary
2 Sep 2009, 9:16 PM
I found the solution, just add triggerAction: 'all' and every thing is ok

Thank you