这是我的代码:
$(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 以便对选择进行进一步操作。当从自动完成中选择一个值时,我想将 VenueID 和 ID 保存在隐藏字段中。
提前谢谢了。