如何在jqGrid jqueryui autocomplete中锚定下拉菜单
jqGrid文本框包含jQuery UI自动完成 我试图添加按钮,以打开下面的组合代码基于奥列格伟大的答案 若下拉菜单打开且jqgrid滚动,则下拉菜单位置不会改变 如何将下拉菜单定位到文本框,使其位于滚动的文本框角落如何在jqGrid jqueryui autocomplete中锚定下拉菜单,jqgrid,jquery-ui-autocomplete,Jqgrid,Jquery Ui Autocomplete,jqGrid文本框包含jQuery UI自动完成 我试图添加按钮,以打开下面的组合代码基于奥列格伟大的答案 若下拉菜单打开且jqgrid滚动,则下拉菜单位置不会改变 如何将下拉菜单定位到文本框,使其位于滚动的文本框角落 {"name":"Custtype","edittype":"custom","maxlength":15, "editoptions": {"custom_element":function(value, options) { return combobox_elem
{"name":"Custtype","edittype":"custom","maxlength":15,
"editoptions": {"custom_element":function(value, options) {
return combobox_element(value, options,'24','Klliik0_nimetus','Klient')}
,"custom_value":function(elem, operation, value) {
return $("input", $(elem)[0]).val();
}
}
}
function combobox_element(value, options, width) {
var elemStr = '<div><input style="width:' + width + 'px" value="' +
value + '"/>' +
'<button type="button" style="height:16px;vertical-align:center" class="ui-icon-triange-1-s" style="margin-left:-1px" tabindex=-1/></div>';
var newel = $(elemStr)[0];
var input = $("input", newel);
input.autocomplete({
source: 'AutoComplete',
position: { collision: 'flip flip' }
}
)
.autocomplete('widget').css('font-size', '12px');
return newel;
}
index.aspx包含来自的样式
但若垂直滚动jqgrid,则下拉菜单不会随文本框一起移动
<style>
.ui-autocomplete
{
max-height: 300px;
overflow-y: auto; /* prevent horizontal scrollbar */
overflow-x: hidden; /* add padding to account for vertical scrollbar */
padding-right: 20px;
z-index: 99999;
position: fixed;
top: 0px;
margin: 20px 0px 0px 0px; /* The top margin defines the offset of textbox */
}
/* IE 6 doesn't support max-height
* we use height instead, but this forces the menu to always be this tall
*/
* html .ui-autocomplete
{
height: 100px;
}