惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
美团技术团队
Last Week in AI
Last Week in AI
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
雷峰网
雷峰网
阮一峰的网络日志
阮一峰的网络日志
博客园 - 叶小钗
IT之家
IT之家
Google DeepMind News
Google DeepMind News
D
Docker
J
Java Code Geeks
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 【当耐特】
V
V2EX
Hugging Face - Blog
Hugging Face - Blog
博客园 - Franky
月光博客
月光博客
宝玉的分享
宝玉的分享
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 瑞德船长

Visual C#如何使用Active X组件 Ext.tree.TreePanel 在IE下不正常加载 - 瑞德船长 - 博客园 Windows mobile 开发入门—控件开发(漂亮的进度条) Windows mobile 开发入门—GPS程序的开发 Windows mobile 开发入门—网络程序的开发 Windows mobile 开发入门—开发绚丽滑动效果 Windows mobile 开发入门—第一个程序"hello world",链接调试,模拟器的使用 Windows mobile 开发入门—环境搭建 短信PDU编码解码(转) 发布一个小工具:建立站点和域名绑定(附代码) 委托(delegate)的异步调用 实用JavaScript脚本代码大全 - 瑞德船长 - 博客园 动态创建DataGrid 列排序功能的实现 多表头 Active report-在Web 上使用 active report Mediar.framework--Search 功能 微软RC2CryptoServiceProvider 加密的疏忽 Mediar.Framework—业务的实现3 (控制UI控件的可视和可编辑属性、验证、以及一对一,一对多,多对多关系) Mediar.Framework—业务的实现2(UI 与对象实体的通信)
Ext.form.ComboBox setValue()初始值设定问题
瑞德船长 · 2010-03-14 · via 博客园 - 瑞德船长

在Store加上一个listeners时设置ComBox中对应的键值。

Html代码 复制代码

  1. var nodeNameStore = new Ext.data.JsonStore({   
  2.         url : Listener   
  3.                 + '?className=etl.db.Node&methodName=getAllNodeJSON&paramCount=0',   
  4.         totalProperty : 'results',   
  5.         root : 'root',   
  6.         fields : ['nodeId', 'nodeName'],   
  7.         listeners : {   
  8.             load : function() {   
  9.                 nodeName.setValue(nodeName.getValue());   
  10.             }   
  11.         }   
  12.     });   
  13.     nodeNameStore.load();   
  14.   
  15.     var nodeName = new Ext.form.ComboBox({   
  16.         xtype : "combo",   
  17.         name : "nodeName",   
  18.         fieldLabel : "所在作业节点",   
  19.         displayField : 'nodeName',// 下拉框显示的值   
  20.         valueField : 'nodeId',   
  21.         store : nodeNameStore,   
  22.         triggerAction : 'all',   
  23.         editable : false,   
  24.         allowBlank : false,   
  25.         emptyText : '请选择作业节点',   
  26.         selectOnFocus : true   
  27.     });   
  28. nodeName.setValue("1");  

这样在设置时会自动显示正确的dispalyField;

转自http://tanlingcau.javaeye.com/blog/588916