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);
}
}
});
};
Ext 查询控件
最新推荐文章于 2021-11-30 18:19:52 发布