PDA

View Full Version : Ext.form.ComboBox hiddenValue problem



da_bar
13 Feb 2010, 2:53 PM
Reciepts.grid.getTopToolbar().add(
{
id: 'tax-print-reciept',
name: 'tax',
store: new Ext.data.ArrayStore({
fields: [
'tax',
'displayText'
],
data: [['true', trans.translate('WITHTAX')], ['false', trans.translate('WITHOUTTAX')]]
}),
displayField: 'displayText',
valueField: 'tax',
hiddenName : 'tax',
hiddenValue: 'true',
value: trans.translate('WITHTAX'),
typeAhead: true,
forceSelection: true,
mode: 'local',
triggerAction: 'all',
selectOnFocus: true,
editable: true,
xtype: 'combo'
});

I have this code, that should have two values with corresponding texts, one value is true and other is false, one is selected by default with hiddenValue: 'true', but submitting the form submits value and not hiddenValue, but when I just click on a combo box selector and don't even change value, submit works fine and submits hiddenValue.

Can anyone help?

Eugen_
14 Feb 2010, 5:22 AM
maybe value: 'true' ?

da_bar
14 Feb 2010, 6:04 AM
maybe value: 'true' ?

No, this will show 'true' in combobox but I want it to show translation, same as in preconfigured values.

Eugen_
14 Feb 2010, 6:22 AM
No, this will show 'true' in combobox but I want it to show translation, same as in preconfigured values.
Did you try this?

I use something like this:



var store = new Ext.data.ArrayStore({
fields: [
{name: 'active_id', type: 'bool'},
{name: 'active_title', type: 'string'}
],
data: [[true, 'Yes'], [false, 'No']]
});
var combo = new Ext.form.ComboBox({
name: 'active_id',
hiddenName: 'active_id',
store: store,
allowBlank: false,
fieldLabel: 'Active',
displayField: 'active_title',
valueField: 'active_id',
mode: 'local',
editable: false,
forceSelection: false,
triggerAction: 'all',
selectOnFocus: true,
anchor: '100%'
});
combo.setValue(record.get('active_id'));
It works.

da_bar
14 Feb 2010, 3:01 PM
Did you try this?

I use something like this:



var store = new Ext.data.ArrayStore({
fields: [
{name: 'active_id', type: 'bool'},
{name: 'active_title', type: 'string'}
],
data: [[true, 'Yes'], [false, 'No']]
});
var combo = new Ext.form.ComboBox({
name: 'active_id',
hiddenName: 'active_id',
store: store,
allowBlank: false,
fieldLabel: 'Active',
displayField: 'active_title',
valueField: 'active_id',
mode: 'local',
editable: false,
forceSelection: false,
triggerAction: 'all',
selectOnFocus: true,
anchor: '100%'
});
combo.setValue(record.get('active_id'));
It works.

Yes it works, thank you, but cause I'm using it inline with xtype now I need to have something like


Reciepts.grid.getTopToolbar().findById('currencyId-print-reciept').setValue('usd');

And this sucks big time, cause hiddenValue should work out of the box.
I think I'll report this as a bug.

Tnx