extjs4 combobox学习之可以用来查询的combo
来源:互联网 发布:逆袭 网络剧 在线1 编辑:程序博客网 时间:2024/05/16 03:50
/**
* 编码选择框
*
*
* 用法
*
* xtype:'projecteditfield'
*/
Ext.define('base.view.field.ProjectEditfield', {
extend : 'Ext.form.field.ComboBox',
alias : 'widget.projecteditfield',
requires : ['base.store.PmProjectStore',
'base.model.PmProjectModel'],
displayField : 'name',
valueField : 'id',
queryMode : 'remote',// 载入其根据根据用户的交互动态的数据集。
queryParam : 'proname',// 指定向后台传参数的变量名称。Extjs4默认为query;
typeAhead : false,// 有的地方说的延时查询,事实自动选择
typeAheadDelay : 500,// 间隔时间
autoSelect : true,
minChars : 1,// 最小查询字符数量
triggerAction : 'all',
initComponent : function() {
this.store = Ext.create("base.store.PmProjectStore", {
autoLoad : false,
proxy : {
type : 'ajax',
startParam : 'page.start',
pageParam : 'page.currentPage',
limitParam : 'page.limit',
api : {
read : './pa/project!searchproname.html'
},
reader : {
type : 'json',
root : 'projects',
successProperty : 'success'
}
}
});
this.callParent(arguments);
},
listeners : {
beforequery : function(q, o) {
// 下拉时,查询数据未能获得列表中数据,手工设置下
// console.log("iscall1");
// console.log(q);
if (Ext.isEmpty(q.query)) {
q.query = q.combo.getValue();
}
}
}
* 编码选择框
*
*
* 用法
*
* xtype:'projecteditfield'
*/
Ext.define('base.view.field.ProjectEditfield', {
extend : 'Ext.form.field.ComboBox',
alias : 'widget.projecteditfield',
requires : ['base.store.PmProjectStore',
'base.model.PmProjectModel'],
displayField : 'name',
valueField : 'id',
queryMode : 'remote',// 载入其根据根据用户的交互动态的数据集。
queryParam : 'proname',// 指定向后台传参数的变量名称。Extjs4默认为query;
typeAhead : false,// 有的地方说的延时查询,事实自动选择
typeAheadDelay : 500,// 间隔时间
autoSelect : true,
minChars : 1,// 最小查询字符数量
triggerAction : 'all',
initComponent : function() {
this.store = Ext.create("base.store.PmProjectStore", {
autoLoad : false,
proxy : {
type : 'ajax',
startParam : 'page.start',
pageParam : 'page.currentPage',
limitParam : 'page.limit',
api : {
read : './pa/project!searchproname.html'
},
reader : {
type : 'json',
root : 'projects',
successProperty : 'success'
}
}
});
this.callParent(arguments);
},
listeners : {
beforequery : function(q, o) {
// 下拉时,查询数据未能获得列表中数据,手工设置下
// console.log("iscall1");
// console.log(q);
if (Ext.isEmpty(q.query)) {
q.query = q.combo.getValue();
}
}
}
});
以上代码在用的时候,最好在保存之前加上
var depname = Ext.getCmp("customerUuid").value;//取得当前保存到后台的值
var depstore = Ext.getCmp("customerUuid").store;//取得这个组件的store
var deprawvalue = Ext.getCmp('customerUuid').rawValue;//取得这个组件在渲染后显示的值
console.log(depname);
console.log(deprawvalue);
//循环查询store,找到和rawvalue值相等的项,并把id赋值给变量,为什么再赋值,因为用户有可能在combobox下拉列表框中选择后,再按回车键,
//这样会使这个组件的value变为空值,保存无效的值。所以我在保存之进行了比较再赋值,以判断是否可以保存。
for (var i= 0;i<depstore.getCount();i++){
if (depstore.getAt(i).get('fullName') == deprawvalue){
depname = depstore.getAt(i).get('id');
Ext.getCmp("customerUuid").value = depstore.getAt(i).get('id');
}
console.log(Ext.getCmp("customerUuid").value);
}
- extjs4 combobox学习之可以用来查询的combo
- extjs4 combo 的 键入自动查询
- extjs4 combo 的 键入自动查询
- Extjs4 combobox模糊查询
- EXTJS4.x之combobox的使用
- Extjs4 combobox 的使用
- ExtJs4学习笔记(七) ComboBox扩展之百度搜索栏
- jQuery EasyUI 为Combo,Combobox 学习记录
- Extjs4中combo的联动选择
- Extjs4.0 Combobox的使用
- Extjs4带清空功能的ComboBox
- ExtJS4学习笔记(十六)---Combobox三级联动
- DHTMLX combo的学习
- Combo的自动查询技术
- 一些好的开源的项目,可以用来学习
- 可以搜索的ComboBox----
- extjs4.1:两个combobox的联动
- ExtJS4学习笔记之window的创建
- 10g RAC改归档模式步骤
- IPC之System V 信号量(后续代码实现)
- ext.grid的配置属性和方法
- jetty线程池的实现
- ubuntu下安装Apache+PHP+Mysql
- extjs4 combobox学习之可以用来查询的combo
- Spring Form Tags
- 利用Squid搭建透明代理网关服务器
- csdn太不给力了
- Fedora 15 SSH安装与配置
- ios定时自动退出UIAlertView提示框
- Fedora下搭建FTP服务器-VSFTP
- iOS程序退出的时候不执行dealloc函数的疑惑
- 用Python写一个小小的爬虫程序