【发布时间】:2017-08-09 20:53:29
【问题描述】:
我创建了一个页面,该页面呈现具有 2 列(城市、国家/地区)的 agGrid。我已使用“cellEditor”名称“TypeaheadCellEditor”将“City”列作为预输入。在这个 cellEditor 中,我正在使用本地数据调用预输入代码,但它不起作用。我尝试检查 DOM,提示输入建议的 ul 不可见。
function TypeaheadCellEditor() {}
TypeaheadCellEditor.prototype.init = function(params) {
this.eInput = document.createElement('input');
this.eInput.setAttribute("id", "search1");
this.eInput.setAttribute("data-provide", "typeahead");
this.eInput.setAttribute("data-items", "4");
this.eInput.setAttribute("class", "span3");
this.eInput.value = params.value;
var subjects = ['PHP', 'MySQL', 'SQL', 'PostgreSQL', 'HTML', 'CSS', 'HTML5', 'CSS3', 'JSON'];
$('#search1').typeahead({
source: subjects
})
};
同时,我在此网格上方的文本框中使用了相同的 typeahead 代码,它在那里工作。我有演示here
【问题讨论】:
-
您能否发布您遇到的错误
-
控制台没有错误。您可以在我发布的链接中运行演示(链接到 plnkr)。plnkr.co/edit/0kMK0bbebUOLbhZwmMkV?p=preview
标签: typeahead.js ag-grid bootstrap-typeahead