kendo Ui实现搜索选中建议 不改变输入框的值
$("#SubjectFilter").kendoAutoComplete({
dataTextField: "patientCardNumber",
template: $("#header-template2").html(),
messages: {
noData: "未找到受试者"
},
filter: "eq",
autoBind: false,
minLength: 3,
select: function (e) {
if (!e.dataItem) {
return
}
kendo.destroy($("#divEmrInputHtml"));
$("#divEmrInputHtml").html('');
$("#emrFooter").hide();
var p = e.dataItem;
//do something
e.preventDefault();
},
dataBound: function (e) {
//只有一个患者开始默认加载
if (this.ul.find('>*').length == 1) {
this.close();
this.trigger('select', { dataItem: this.dataItems()[0] });
return;
}
//多条记录默认选中未结束的
var aa = this.ul.find('>:not(:has(.project-c))');
if (aa.length == 1) {
this.trigger('select', { dataItem: this.dataItem(aa) });
aa.addClass('k-state-focused k-state-selected')
} else if (aa.length > 1) {
abp.notify.warn('该受试者同时参与了多个项目')
}
},
dataSource: {
type: "abpapi",
serverFiltering: true,
transport: {
parameterMap: function (data, type) {
return { query: $("#SubjectFilter").val() };
},
read: {
url: abp.appPath + 'api/services/app/subject/findByQuery',
}
}
}
}).focusin(function () {
$("#SubjectFilter").data('kendoAutoComplete').popup.open()
});
posted on 2019-10-10 20:00 RedQ-Alright 阅读(188) 评论(0) 收藏 举报
浙公网安备 33010602011771号