ui-grid
ui-grid copied to clipboard
bootstrap-typeahead is not working in ng-grid.
I'm working in a project, where I have to show a typeahead in a ng-grid cell. But, the typeahead is not working in a ng grid cell. I have put a Plunker.
See that the typeahead is working in the same page above the grid. But it's not working in the ng grid cell. Can you please help?
I believe I have it working: http://plnkr.co/edit/cum0CBuoJUvGIBu85aBS?p=preview
- The .ngCell class by default hides overflow. You need to override that so that the typeahead popup will be visible.
- In your cell template. the input needs to be wrapped in a div for the typeahead popup to be inserted into the DOM.
- You have to bind to myData (or whatever your data variable is named) in the template, as ngGrid doesn't store the evaluated data object somewhere accessible in the scope, but does inherit from the parent scope.
- I went ahead and set up how you would bind to different models for the typeahead ng-model directive (i.e. use an array).
@c0bra Your solution is fine for cases where pre-existing data doesn't exist; however, what if you need your typeahead to be bound to the data property of gridOptions? How do you then propagate changes back to the data?