PDA

View Full Version : [Solved]Strange behaviour of combobox in form using direct



Wolfgang
4 Apr 2010, 8:38 AM
Using a combobox in a form that uses ext.direct to load / save leads to trouble with "hiddename", "name" property. Either combo does not load or it does submit the display value.



fieldLabel: this.hosttypeText
,xtype: 'combo'
,name: 'hosttype' // needed to get load working but then submit sends displayField - and - must not enable hiddenName
//,hiddenName:' hosttype' // needed to submit valuefield - but then load fails
,allowBlank:false
,mode: 'local'
,editable: false
,triggerAction : 'all'
,forceSelection: true
,valueField: 'value'
,displayField: 'name'
,store: new Ext.data.ArrayStore({
fields: ['value', 'name']
,data : [
['shost', this.shostText]
,['vhost', this.vhostText]
]
})

To get load working i need to enable "name". However then submit sends the content of displayField. (expected)

To get submit use valueField, i have to enable "hiddenname", but then load no longer works. (unexpected)
When Setting both "name" and "hiddename, load fails.
Using different values for "name", "hiddenname" did not help.

Any ideas?

Just in case, the JSON returned on load


{"type":"rpc","tid":4,"action":"Hosts","method":"get","result":{"success":true,"data":{"hostname":"host1.local","hosttype":"vhost","username":"host1-username","password":"host1-password"},"debug":null}}

Wolfgang
4 Apr 2010, 8:46 AM
Found the issue right after posting. Note the space before hosttype. (:|


,hiddenName:' hosttype'

steffenk
4 Apr 2010, 9:12 AM
all this issues took me a while too. But if you got it once it's a real pleasure with ExtDirect, i love it!

Sleep well :)