ExtJs 4 Combobox missing config option hiddenName
I'm trying to create an ExtJs version 4 ComboBox that will post the valueField and not the displayValue. Prior version would be to set the 'hiddenName' option in the config of ComboBox, but I can't seem to find it in v 4 or something equivalent. Also, this is NOT in an ExtJs form panel. The combobox is being rendered inside a plain html form
//My Code
new Ext.form.ComboBox({
renderTo: 'my_div',
store: new Ext.data.SimpleStore({
fields: ['value', 'name'],
data: [['1', 'A'], ['2', 'B'], ['3', 'C']]
}),
name: 'letter'开发者_如何学Python,
hiddenName: 'letter_id',
hiddenValue : '0',
displayField: 'name',
valueField: 'value',
mode: 'local'
});
// The value of the form POST when I selected 'A'
"letter=A"
// This is what I want
"letter=1"
just for info.... Extjs team has improved the "configs" for every element.
And in combobox
there is no longer hiddenName
have you ever read this? try to navigate to page 52, both will yield similar results...
var itemForm = Ext.create('Ext.form.FormPanel',{
title: 'Simple Form',
renderTo :Ext.getBody(),
url :'test.php',
items:[
new Ext.form.ComboBox({
store: new Ext.data.SimpleStore({
fields: ['value', 'name'],
data: [['1', 'A'], ['2', 'B'], ['3', 'C']]
}),
name: 'letter',
displayField: 'name',
valueField: 'value',
})]
});
when i run this itemForm.getForm().submit()
it send letter = 1
..
maybe the error is somewhere else ..
After stuck 8 hours i found problem my store respond from server contain "\r" or "\n" Just remove it it will work fine :)
精彩评论