Ext.Data.Store如何将多个字段拼接起来?
来源:互联网 发布:apache spark python 编辑:程序博客网 时间:2024/06/05 21:18
现在要求实现的是:后台传来的字段有两个:数据库db_cn和用户schema_nm。但是现在要求下拉框中显示的是这两个字段合成的一个值:用户@数据库。如下:
首先我们应当明白在一个页面加载的时候,ext的多选框combo页面组件是怎么触发事件的。首先写好的页面组件combo先体现在页面上,然后combo的仓库首先load,以取得后台的值,然后将load的值传入仓库进行reader,此时这些值就已经可以用ext的方法调用了。所以我们需要在load中实现将用户schema_nm值设置为用户@数据库的值,代码如下:
//数据库storevar DBStore = new Ext.data.Store( {proxy : new Ext.data.HttpProxy( {url : '../../extjs.do?action=getSelectAction'}),reader : new Ext.data.JsonReader( {root : 'root',id : 'schema_nm'}, [ {name : 'schema_nm'}, {name : 'db_cn'} ]),listeners : {load : function(DBStorestore,records){alert(records);//<span style="font-family:KaiTi_GB2312;">records是一个数组,是需要的参数组成的对象的集合</span>for(var i=0;i<records.length;i++){//alert(records[i].get('schema_nm'));//alert(records[i].get('db_cn'));records[i].set('schema_nm',records[i].get('schema_nm')+"@"+records[i].get('db_cn'));//alert(records[i].get('schema_nm'));}}}});
0 0
- Ext.Data.Store如何将多个字段拼接起来?
- mysql 如何把两个字段拼接起来
- Ext.data-Store
- [转载]Ext.data-Store
- Ext.data.Store
- Ext.data.Store介绍
- Ext.data.Store
- Ext.data.Store
- Ext.data.Store
- Ext.data-Store
- Ext.data-Store
- Ext.data-Store
- Ext.data.Store
- Ext.data.Store
- Ext.data.Store
- Ext.data.Store
- Ext.data-Store
- Ext.data.Store
- 【CSS】CSS样式总结
- LeetCode之Binary Search题目汇总
- 记使用HTML5 + JS 构建水果忍者游戏
- spring中的AppllicationContext详解
- hibernate第一章上
- Ext.Data.Store如何将多个字段拼接起来?
- 每日一vim(5)c命令(change命令)
- stdarg.h
- PHP学习练手(九)
- 蓝桥杯之数列特征
- 【跟我学spring 4.0 】之第五节-配置bean之间的关系:继承、依赖
- Java:JScrollPane:根据需要设置滚动条
- java类与实例
- 百万员工信息随机生成和工资求和问题