Ext 查询控件

var findNurseList = function(){
if(document.readyState != "complete")
return;
nurseAccountService.getNurseContactList({
callback:function(data){
nurseData = [];
if(data == null)
return;
for(var i =0;i<data.length;i++){
var sameflag = true;
for(var j=0;j<nurseData.length;j++){
if(data[i].emp_id != null && data[i].emp_id == nurseData[j].emp_id){
sameflag = false;
}
}
if(sameflag)
nurseData[nurseData.length] = data[i];
}
initComboBox();
}.createDelegate(this),
exceptionHandler: function() {
HelixMsg.alert(HelixMsg.ERROR, '', '加载失败');
}.createDelegate(this)
});
var str = Ext.get('nurse_id').dom.innerHTML;
window.mailWriter.writer.$receiverDiv.css("border","0px");
window.mailWriter.writer.$receiverDiv.html(str);
}


/**
*初始化下拉框
*/
var initComboBox = function(){
var ds = new Ext.data.JsonStore({
data:{root:nurseData},
root:'root',
fields:[
{name: 'user_id', mapping: 'nurse_sn'},
{name: 'name', mapping: 'name'},
{name: 'group_name', mapping: 'group_name'},
{name: 'name_in_pinyin', mapping: 'name_in_pinyin'},
{name: 'emp_id', mapping: 'emp_id'}
]
});

// 显示的样式
var resultTpl = new Ext.XTemplate(
'<tpl for="."><div class="search-item">',
'<table><tr><td width="80px">{name}</td><td>{group_name}</td></tr></table>',
'</div></tpl>'
);

search = new Ext.form.ComboBox({
store: ds,
displayField:{fn:function(r){
var value = search.getValue();
var flag = false;
value = this.data.createValueMatcher(value);
if(r.data['name_in_pinyin'] != null)
flag = value.test(r.data['name_in_pinyin']);
if(!flag)
flag = value.test(r.data['name']);
return flag;
}},
typeAhead: false,
mode: 'local',
loadingText: 'Searching...',
width: 435,
minChars : 1,
hideTrigger:true,
applyTo: 'nurse_list',
tpl:resultTpl,
itemSelector: 'div.search-item',
onSelect : function(record, index){
if(this.fireEvent('beforeselect', this, record, index) !== false){
var emp_id = record.data['emp_id'];
var name = record.data['name'];
if(emp_id == null){
HelixMsg.alert(HelixMsg.ERROR, '', name+"没有账号,不能接收邮件。");
return;
}
window.mailWriter.writer.$receiverId.val(emp_id);
window.mailWriter.writer.$receiverName.text(name);
this.setValue(name);
this.collapse();
this.fireEvent('select', this, record, index);
}
}
});
};
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值