Javascript mcautocomplete在光滑网格上消失
我将mcautocomplete添加到我的slickgrid中。如果我选中一些复选框,mcautocomplete表在slickgrid上不再可见。请检查图片。 如何确保我的自动完成选项在我的网格上可见Javascript mcautocomplete在光滑网格上消失,javascript,autocomplete,slickgrid,Javascript,Autocomplete,Slickgrid,我将mcautocomplete添加到我的slickgrid中。如果我选中一些复选框,mcautocomplete表在slickgrid上不再可见。请检查图片。 如何确保我的自动完成选项在我的网格上可见 $.widget('custom.mcautocomplete',$.ui.autocomplete{ _创建:函数(){ 这个; this.widget()菜单(“选项”,“项目”,“>:非(.ui小部件标题)”; }, _renderMenu:功能(ul,项目){ var self=这个,
$.widget('custom.mcautocomplete',$.ui.autocomplete{
_创建:函数(){
这个;
this.widget()菜单(“选项”,“项目”,“>:非(.ui小部件标题)”;
},
_renderMenu:功能(ul,项目){
var self=这个,
thead;
if(this.options.showHeader){
表=$('');
$.each(this.options.columns,函数(索引,项){
表.追加(“”+item.name+“”);
});
表.附加(“”);
ul.附加(表);
}
$。每个(项目、功能(索引、项目){
自我评估(ul,项目);
});
},
_renderItem:功能(ul,项目){
变量t=“”,
结果='';
$.each(this.options.columns,函数(索引,列){
t+=''+项[column.valueField?column.valueField:索引]+''
});
结果=$(“”)
.data('ui-autocomplete-item',item)
.附加(“”+t+“”)
.附录(ul);
返回结果;
}
});
您可以尝试使用z-index(这可能很复杂,而且都取决于容器元素的优先级),但我发现一些javascript控件的结构与SlickGrid不兼容。(并不是说mcautocomplete不兼容,有正确的调整,但可能不兼容)
例如,我在下拉列表中使用了“selected”,但由于它使用的表元素与slickgrid基础设施不兼容,所以我不得不放弃使用“select2”。6pac github存储库中有一个“select2”示例,我认为select2具有自动更正模式。可能值得一试。我找到了这个例子,效果很好。非常感谢你。
$.widget('custom.mcautocomplete', $.ui.autocomplete, {
_create: function () {
this._super();
this.widget().menu("option", "items", "> :not(.ui-widget-header)");
},
_renderMenu: function (ul, items) {
var self = this,
thead;
if (this.options.showHeader) {
table = $('<div class="ui-widget-header" style="width:100%"></div>');
$.each(this.options.columns, function (index, item) {
table.append('<span style="font-weight:bold;background-color:#EEE8AA;padding:0 4px;float:left;width:' + item.width + ';">' + item.name + '</span>');
});
table.append('<div style="clear: both;"></div>');
ul.append(table);
}
$.each(items, function (index, item) {
self._renderItem(ul, item);
});
},
_renderItem: function (ul, item) {
var t = '',
result = '';
$.each(this.options.columns, function (index, column) {
t += '<span style="background-color:#ADD8E6;padding:0 4px;float:left;width:' + column.width + ';">' + item[column.valueField ? column.valueField : index] + '</span>'
});
result = $('<div></div>')
.data('ui-autocomplete-item', item)
.append('<div class="mcacAnchor">' + t + '<div style="clear: both;"></div></div>')
.appendTo(ul);
return result;
}
});