[英]EXTJS 4 : how to get combobox value with out determine combobox id
var StaticComboBox = Ext.define('MyApp.view.ComboBoxType', {
extend: 'Ext.form.ComboBox',
mode: 'local',
fieldLabel: 'Type',
labelWidth: 50,
triggerAction: 'all',
editable: false,
valueField: 'value',
displayField: 'label',
data: [
{value: 0, label: 'By Vehicle'}, {value: 1, label: 'By Route'}
] ,
initComponent: function() {
this.store = new Ext.data.Store({
fields: ['value', 'label'],
data: this.data
});
StaticComboBox.superclass.initComponent.call(this);
},
listeners: {
change: function (combo, value) {
var grid = Ext.ComponentQuery.query('dailywindow gridpanel[name=mydailychartgrid]')[0];
if (grid != null){
if (value == 0) {
//grid.reconfigure(VehicleStore_Chart,VehicleModel)
grid.reconfigure(VehicleStore_Chart);
grid.columns[1].setText('Plat No');
grid.columns[1].dataIndex = "Plat_No"
grid.columns[1].width = 100
}else{
//grid.reconfigure(RouteNameStore_DailyChart,RouteModel)
grid.reconfigure(RouteNameStore_DailyChart)
grid.columns[1].setText('Route Code');
grid.columns[1].dataIndex = "Route_Code"
grid.columns[1].width = 100
}
}
//alert(value);
}
}
});
var c = new StaticComboBox();
c.setValue(0);
how do i get the combobox value without using determine id in combobox ? 如何在不使用combobox的确定ID的情况下获取combobox的值?
Ext.getCmp("ComboBoxType").getValue()
does not work. Ext.getCmp("ComboBoxType").getValue()
不起作用。
Yes, you should add 'id'
property to combobox and then use the 'Ext.getCmp('componentId')'
是的,您应该将'id'
属性添加到组合框,然后使用'Ext.getCmp('componentId')'
or 要么
Assign 'name'
property to it and use the componentquery
. 给它分配'name'
属性,并使用componentquery
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.