$(function() {
$( "#customer_name" ).autocomplete({
source: function( request, response ) {
$.ajax({
url: "/management/order/auto",
dataType: "json",
data: {name: request.term},
success: function(data) {
var suggestions = [];
$.each(data, function(i, val) {
suggestions.push({
label: val.name,
code: val.code,
id: val.id,
});
});
response( suggestions );
},
});
},
select: function(e, ui) {
$('#customer_id').val(ui.item.id);
$('#customer_code').val(ui.item.code);
},
maxShowItems: 5,
});
});
maxShowItems已添加到自动填充选项中。它接受物品的最大高度lis
我添加了<?php echo Asset::js('jquery.ui.autocomplete.scroll.min.js') ?>
,但它不起作用。谢谢帮助我。
答案 0 :(得分:0)
您只需将overflow: scroll
添加到具有固定高度的#customer_name
。
#customer_name {height: 100px;width: 300px;overflow: scroll;}
&#13;
<div id="customer_name">
A web page (or webpage) is a web document that is suitable for the World Wide Web and the web browser. A web browser displays a web page on a monitor or mobile device. The web page is what displays, but the term also refers to a computer file, usually written in HTML or comparable markup language, whose main distinction is to provide hypertext that will navigate to other web pages via links. Web browsers coordinate web resources centered around the written web page, such as style sheets, scripts and images, to present the web page.
</div>
&#13;
答案 1 :(得分:0)
$('#jqxInput').on('open', function (event) {
$('.jqx-menu-vertical-bootstrap').css({
'max-height': '300px',
'overflow-y': 'auto',
'overflow-x': 'hidden',
});
});