日期:2014-05-16  浏览次数:20687 次

Ext中两个下拉框联动并设置默认值
本帖最后由 zongzhankui 于 2013-09-27 20:11:47 编辑

SLA指标模板和业务保障天数是两个下拉框,而且实现联动。当SLA指标模板选中某个值时,业务保障天数这个下拉框会默认选中某个值显示。

var slaTemplateId = Ext.getCmp("slacust-slaTemplateId").getValue();
Ext.getCmp("slacust-svcAssuranceSday").setValue("");
//    Ext.getCmp("slacust-svcAssuranceSday").store.proxy = new Ext.data.HttpProxy(
//    {url:WEB_ROOT+'/queryCondition_getEnumValues.do?enumerateSql=select d.dict_code, d.dict_name from dictionarys d, sla_template s where s.svc_assurance_sday=d.dict_code and s.sla_template_id= '
//                 + 1012});
Ext.getCmp("slacust-svcAssuranceSday").store.proxy = new Ext.data.HttpProxy(
{url:WEB_ROOT+'/queryCondition_getEnumValues.do?enumerateSql=select t.dict_code, t.dict_name from dictionarys t where t.d.dict_code = 117100'}); 
// Ext.getCmp("slacust-svcAssuranceSday").on();
Ext.getCmp("slacust-svcAssuranceSday").store.load();

如业务保障天数是星期一到星期日的下拉框,当我在SLA指标模板中选中某个值时,业务保障天数会显示星期一,而且可以修改(选其他)。
怎么实现???
注释掉的代码是下拉框中只有星期一,而且不是默认选中。
------解决方案--------------------
combobox的setValue方法设置哪个选中,选不中输出对应的内容看看是否存在combobox的valueFiled对应值
------解决方案--------------------
用 combo.select()