Ext.form.ComboBox 设置默认值能触发select事件的问题

var newcombox = new Ext.form.ComboBox({ store: new Ext.data.JsonStore({ url: comboxUrl, root: 'data', fields: ['activityId', 'activityName'], autoLoad :true, listeners:{ 'load':function(){ newcombox.setValue(1); } } }), displayField: 'activityName', id: 'activityCombox1', valueField: 'activityId', editable: false,

第1个回答  2012-12-07
确保在store load完成后set 默认值在此句后newcombox.setValue(1); newcombox.fireEvent('select',newcombox); 具体fireEvent使用可参见API
第2个回答  2013-01-02
强制触发select事件需要一个方法fireEvent,该方法可以如同jquery一样进行链式的写法。

具体见参考资料.

参考资料:http://luacloud.com/2012/extjs-combo-trigger-select-event-solution-using-the-setvalue.html

相似回答