Easyui combobox设置值和文本的几种方式和问题
来源:互联网 发布:php的框架有哪些 编辑:程序博客网 时间:2024/06/06 05:36
Easyui combobox设置值和文本的几种方式和问题
1、在Easyui 帮助文档中,我们可以看到combobox是继承自combo,combo中有两上方法:setText、setValue。
2、combobox设置值的方式一:
//获取从后台传过来的客户idvar customerId = '${customer.id}';//初始化顾客下拉列表$("#customerCombobox").combobox({ url : "${basePath}/customer/queryCustomers.do?", valueField:'id', textField:'name', width:150, dataPlain : true, //设置默认值 value : customerId});
此种方式可以正常设置,运行如下图:
3、combobox设置值的方式二:
//初始化顾客下拉列表$("#customerCombobox").combobox({ url : "${basePath}/customer/queryCustomers.do?", valueField:'id', textField:'name', width:150, dataPlain : true});//设置值$("#customerCombobox").combobox('setValue','${customer.id}');//设置显示文本$("#customerCombobox").combobox('setText','${customer.name}');
此种方式,没有设置成功,运行如图:
4、combobox设置值的方式三:
//初始化顾客下拉列表$("#customerCombobox").combobox({ url : "${basePath}/customer/queryCustomers.do?", valueField:'id', textField:'name', width:150, dataPlain : true, onLoadSuccess: function(){ //设置默认值 $(this).combobox('setValue','${customer.id}'); } });
此种方式设置成功,运行结果如图:
5、小结 :
Easyui 中的onLoadSuccess说明:
tree和combotree:当数据加载完成之后触发onLoadSuccess事件。
form:当数据开始加载的时候触发onLoadSuccess事件
阅读全文
0 0
- Easyui combobox设置值和文本的几种方式和问题
- easyUI combobox 加载数据的几种方式
- easyui-combobox设置值
- easyUI的Combobox问题
- easyui-combobox的取值问题
- EASYUI设置combobox的默认值
- comboBox 加载数据的几种方式
- easyui-combobox 取值问题
- easyui-combobox 取值问题
- easyUI对combobox设置value和text
- easyui combobox text与value设置不同的值
- 怎么设置easyui 的 combobox的默认值
- easyui中combobox设置默认值的方法
- jquery easyui设置easyui-combobox高度 ,启用和禁用
- easyui的easyui-combobox
- easyui combobox设置选中
- EasyUI Combobox 设置默认值
- easyui combobox设置选中
- Vue-高级讲师之笔记06
- Leetcode 309. Best Time to Buy and Sell Stock with Cooldown
- 代码更换SeekBar进度条颜色
- 课堂在线Java程序设计作业 类的使用
- 【总结】数据预处理
- Easyui combobox设置值和文本的几种方式和问题
- jQuery setInterval倒计时精确到毫秒
- 【性能测试】-常见性能测试问题分析(一)
- shiro
- Vue-高级讲师之笔记07(结尾)
- C++文本文件的读写
- tensorflow-张量
- C# Process运行cmd命令的异步回显
- 重排序