简体   繁体   English

用ag-Grid提前输入

[英]Typeahead with ag-Grid

I am trying to implement typeahead in ag-Grid using Angular 1. The typeahead implementation shown in ag-Grid documentation site is using ng2-typeahead which is an Angular 2 typeahead. 我正在尝试使用Angular 1在ag-Grid中实现预输入。ag-Grid文档站点中显示的预输入实现使用的是ng2-typeahead,即Angular 2预输入。

Since the application I am working on is Angular 1.5 based, I tried implementing Angular typeahead (ui.bootstrap.typeahead) using cell-editor. 由于我正在处理的应用程序基于Angular 1.5,因此我尝试使用单元格编辑器实现Angular typeahead(ui.bootstrap.typeahead)。 Somehow, it doesn't seem to work in the grid. 不知何故,它似​​乎在网格中不起作用。 The column in which I am trying to bring in typeahead is 'Release'. 我要提前输入的栏是“发布”。 The cell-editor I have created is 'ReleaseEditor'. 我创建的单元格编辑器是“ ReleaseEditor”。 I am using a live JSON service for getting the data. 我正在使用实时JSON服务来获取数据。 It would be great if somone could help me with this. 如果有人可以帮助我,那将是非常棒的。

Cell Editor created 单元格编辑器已创建

function ReleaseEditor() {
}

ReleaseEditor.prototype.init = function (params) {
    this.eInput = document.createElement('input');
    this.eInput.setAttribute("typeahead", "suggestion for suggestion in cities($viewValue)");
    this.eInput.setAttribute("typeahead-wait-ms", "300");
    this.eInput.setAttribute("ng-model", "result");
    this.eInput.value = params.value;

};

ReleaseEditor.prototype.getGui = function () {
    return this.eInput;
};

ReleaseEditor.prototype.afterGuiAttached = function () {
    this.eInput.focus();

};

ReleaseEditor.prototype.getValue = function () {
    return this.eInput.value;
};

This is the link to the plnkr . 这是到plnkr的链接

On setting angularCompileRows:true on the gridOptions object, it is working now. gridOptions对象上设置angularCompileRows:true时,它现在正在工作。 I have updated the working demo under the plnkr, http://plnkr.co/edit/sbM5kewn8mD0w8qkv5ZO?p=preview 我已经更新了plnkr下的工作演示, http: //plnkr.co/edit/sbM5kewn8mD0w8qkv5ZO?p = preview

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM