我有一段EXT的COMBO,现在保存不了值,请问怎么解决,详细代码如下:
Ext.onReady(function() {Ext.tip.QuickTipManager.init();
// Define the model for a State
Ext.define('State', {
extend: 'Ext.data.Model',
fields: [
{type: 'string', name: 'code'},
{type: 'string', name: 'name'}
]
});
// The data for all states
// The data store holding the states; shared by each of the ComboBox examples below
var store = new Ext.data.Store({
model: 'State'
});
// Simple ComboBox using the data store
var littletype = Ext.create('Ext.form.field.ComboBox', {
id:'dailyReport_lookups_name',
renderTo: 'littletype',
displayField: 'name',
valueField: 'code',
store: store,
width: 150,
editable:false,
name: 'dailyReport.lookups.name',
hiddenName:'dailyReport.lookups.code',
hiddenValue:'code',
typeAhead: true,
queryMode: 'local',
emptyText: '请选择',
blankText: '请选择',
listeners: {
"select": function (combo, record, index) {
document.getElementById("dailyReport.lookups.code").value=combo.value;
}
}
});
});
function onload(){
if(document.all('dailyReport.category.code').value!='请选择')
{
Ext.getCmp('dailyReport_lookups_name').store.proxy.url='getLookupsListopinion.action?code='+document.all('dailyReport.category.code').value;
Ext.getCmp('dailyReport_lookups_name').store.load();
}
}
</script>
我想保存CODE,但是lookups这个对象里面传过来的就只有name,求各位大侠帮忙看看。 --------------------编程问答-------------------- ComBox通常我们要用到的是两个值,一个是“隐藏”的——数据库用于储存的值,一个是“显示”的——页面显示的值,比如数据库中"1"对应"男","2"对应"女",而其中的valueField 即对应值“1、2” displayField对应页面实际显示的“文本”值,其中valueField用getValue()即可取得,displayField用getRawValue() 取得。
本人也是Ext新手,答案仅供参考,若有理解接解释错误之处,请其他朋友友好指正。
补充:Java , Web 开发