Extjs ComboBox 动态选中第一项
有时候我们希望通过Store加载过来的数据,ComboBoxItem能够选择第一条数据作为默认数据,我们可以这么操作:
var storeinfo = Ext.create('Ext.data.Store', {
model: SaleInfo,
autoLoad: false,
pageSize: ,
proxy: {
type: 'ajax',
url: '/URL/JSON',
reader: {
type: 'json',
rootProperty: 'Data',
totalProperty: 'TotalCount'
}
}
});
然后定义Storeinfo的Load方法,配置Callback回调
////数据加载之后,回调设置ComboBox选择第一项
storeinfo.load({
scope: this,
callback: function (records, operation, success) {
if (records.length > ) {
Ext.getCmp("BranchId").select(storeinfo.getAt());
}
else {
Ext.getCmp("BranchId").setRawValue("暂无独立法人");
}
}
});
即可;
备注:
1、setRawValue()设置comboBox显示文本内容,getRawValue()获取显示内容文本;
2、setValue()设置comboBox值,getValue()获取comboBox值;
Extjs ComboBox 动态选中第一项的更多相关文章
- Easyui combobox如何默认选中第一项???
以下代码可以实现combobox默认选中第一项,在实际开发中我们可能会用到! // 处理combobox默认选中的问题 <input id="user_type" class ...
- 【WPF】ListBox使用DataTemplate 以及默认选中第一项Item
ListBox中DataTemplate的用法如下 . <ListBox x:Name="areaLB" ItemsSource="{Binding AreaNum ...
- ionic中ng-options与默认选中第一项的问题
1. select中动态添加数据时发现一个选项为空,在选中了其他选项时,在点击时发现第一个空选项消失了,所有我们需要设置一个默认的选项: 2. 开始的时候我用的方法: <select class ...
- easyui的combobox默认选中第一个选项
pmProjectSelect.combobox({ editable:false, width:165, url : ctx + '/PmProject/findByProjectMgr', //c ...
- Easyui combobox下拉框默认选中第一项
var val = $(#cc).combobox("getData");for (var item in val[0]) { if (item == "gr ...
- jquery easyui combobox设置默认选中第一项
combobox的内容是从后台获取的json, js截取: var data = $('#id').combobox('getData'); $("#id ").combobox( ...
- extjs Combobox动态加载数据问题,mode:local 还是remote
var fabircTypeDs = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: 'province.do' }), reade ...
- EasyUI combobox动态增加选择项
有需求需要动态的为combobox增加可选项,后来解决方案如下 html如下 <select id="workerList"></select> js 如下 ...
- 42.extjs Combobox动态加载数据问题,mode:local 还是remote
问题: Java代码 var fabircTypeDs = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: 'province. ...
随机推荐
- CCF 模拟C 找最大矩形+输入输出外挂
http://115.28.138.223:81/view.page?opid=3 统计出连续的最长乘以当前高度,找最大即可 #include<iostream> #include< ...
- BZOJ 1051: [HAOI2006]受欢迎的牛
Description 一个有向图,求所以能被别的点到达的点的个数. Sol Tarjan + 强连通分量 + 缩点. 缩点以后找强连通分量,缩点,然后当图有且仅有1个出度为1的点时,有答案. Cod ...
- 术&道
技术分为术和道两种. 具体做事的方法为术:做事的原理和原则是道. 追求术的人一辈子工作很辛苦,只有掌握了道的本质和精髓才能永远游刃有余. 在纷繁的选择面前, 不知到哪些是对的没关系, 知道哪些是不好的 ...
- tornado 排程
https://groups.google.com/forum/#!topic/python-tornado/KEmAg97zUg8 鉴于不是所有人都能跨越GFW,摘抄如下: Scheduled jo ...
- C++ 输出调试的一些技巧
主要利用了宏和stderr... #define enable_debug #ifdef enable_debug FILL some macros/functions here #else /// ...
- PHP的反射类ReflectionClass、ReflectionMethod使用实例
PHP5 具有完整的反射API,添加对类.接口.函数.方法和扩展进行反向工程的能力. 反射是什么? 它是指在PHP运行状态中,扩展分析PHP程序,导出或提取出关于类.方法.属性.参数等的详细信息,包括 ...
- zaqar项目介绍
Zaqar is a multi-tenant cloud messaging and notification service for web and mobile developers. It c ...
- 【云计算】marathon集群如何升级?
Upgrading to a Newer Version We generally recommend creating a backup of the ZooKeeper state before ...
- POI文件导出至EXCEL,并弹出下载框
相关参考帖子 : [1]http://www.tuicool.com/articles/MnqeUr [2]http://www.oschina.net/question/253469_51638?f ...
- CentOS卸载OpenJDK并安装Sun JDK
第一步:查看Linux自带的JDK是否已安装 (卸载centOS已安装的1.4) 安装好的CentOS会自带OpenJdk,用命令 java -version ,会有下面的信息: java versi ...