gpt4 book ai didi

jquery - Kendo UI 自动完成选择时检索 ID

转载 作者:行者123 更新时间:2023-12-01 07:16:55 24 4
gpt4 key购买 nike

这是我的代码:

 $(document).ready(function() {
var autocomplete = $("#customers").kendoAutoComplete({
minLength: 1,
dataTextField: "VenueName", change:onChange,

select: onSelect,
template: '<img src=\"${data.Thumbnail}" alt=\"${data.VenueName}\" />' +
'<h4>${ data.VenueName }</h4>' +
'<p>${ data.VenueAddress }</p>',
dataSource: {
transport: {
read:{
dataType: "jsonp",
url: "load.php?dbsources=listvenues"
}
}
},
height: 370,
}).data("kendoAutoComplete");


});

数据源将如下所示:

([{"VenueID":"84","ID":"10421","VenueName":"Utivs Venue","VenueAddress":"72/74 Meehan Street" ,"Thumbnail":"10421-logo-sd-175x195-img.png"},{"VenueID":"85","ID":"10429","VenueName":"Richards place","VenueAddress":"2 Cross Street" ,"Thumbnail":"10429-logo-sd-175x195-img.png"},{"VenueID":"86","ID":"10437","VenueName":"Lyndzs House of Mandominion","VenueAddress":"80 Chesterfield Parade" ,"Thumbnail":"10437-logo-sd-175x195-img.png"} ])

如何从数据源获取 VenueID 和 ID 以便对 select 进行进一步操作。当从自动完成中选择值时,我想将 VenueID 和 ID 保存在隐藏字段中。

提前非常感谢。

最佳答案

select: function (ev) {

var dataItem = this.dataItem(ev.item.index());
alert(dataItem.VenueID);
alert(dataItem.ID);
}

关于jquery - Kendo UI 自动完成选择时检索 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17938598/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com