Thank you for reporting this bug. We will make it our priority to review this report.
Combobox problem with Ext 5.1
Combobox problem with Ext 5.1
I had a problem with the combobox and Ext 5.1 (this example worked as expected with Ext 5.0.1)
Code:
{
xtype: 'combobox',
store: Mymodule.GENDER_CHOICES, // (store)
name: 'gender',
queryMode: 'local',
fieldLabel: translate('Gender'),
displayField: 'name',
valueField: 'value',
forceSelection: true,
bind: {
value: '{mainRecord.gender}'
},
}
Mymodule.GENDER_CHOICES is a simple store created like this :Code:
Ext.create('Ext.data.Store', {
"fields": [
"value",
"name"
],
"data": [
{
"name": translate("male"),
"value": 1
},
{
"name": translate("female"),
"value": 2
},
]
})
The field gender is defined like this :Code:
{
"name": "gender",
"type": "integer",
"defaultValue": 1,
"validators": [
{
"type": "presence"
},
{
"list": [
1,
2
],
"type": "inclusion"
}
]
},
And... it doesn't work.The combobox does the validation on the rawValue of the choice ("female" or "male"). I expected the validation to be performed on the "value" of the field (1 or 2).
The only way I found to make the combobox work with Ext5.1 is to overload the isValid method in the field definition :
Code:
{
xtype: 'combobox',
store: Mymodule.GENDER_CHOICES, // (store)
//....
isValid: function() {
var me = this,
disabled = me.disabled,
validate = me.forceValidation || !disabled;
return validate ? me.validateValue(me.getValue()) : disabled;
}
}
Is that normal?
Is that what we want?
Did I do something wrong?
Combobox problem with Ext 5.1
Aucun commentaire:
Enregistrer un commentaire