How to apply auto-complete functionality to the cell of ag-grid?

Viewed 2934

Auto-complete functionality needs to suggest function names which is in a json format and mentioned below:

{
 "id": 260,
 "title": "p_active(Power: number, PowerAngle: number)",
 "type": "PR",
 "category": "AL",
 "structure": "p_active(Power: number, PowerAngle: number)"
}

Here, p_active is a function name, which needs to be included in the suggestion.

1 Answers

I don't think ag-grid has support for autocomplete out of the box, with that being said there are 2 possible solutions I can think of:

  1. Create a custom Cell Renderer component. This allows you to customize your cell with any component however you want, in this case what you can do is have an input there with auto complete. More info about this: https://www.ag-grid.com/javascript-grid-cell-rendering-components/

  2. Use a ready solution/package - here's a package I found: https://www.npmjs.com/package/ag-grid-autocomplete-editor

Here's a stackblitz with the implementation of autocomplete: https://stackblitz.com/edit/ag-grid-autocomplete-editor

Related