I'm making a project with ag grid. But I want to get the input text from the user in the filter field. I need the input from the filter from the user to make an http call. I searched on the website but couldn't get an answer.
Assuming you're using Angular 2 components for this, take a look at the PartialMatchFilterComponent in the examples project.
@Component({
selector: 'filter-cell',
template: `
Filter: <input style="height: 10px" #input (ngModelChange)="onChange($event)" [ngModel]="text">
`
})
class PartialMatchFilterComponent implements AgFilterComponent {
... rest of the class
The in the onChange method you could fire off your requests as the user typed (you'd probably want to add some sort of debounce here):
onChange(newValue):void {
if (this.text !== newValue) {
this.text = newValue;
... fire off your http request here ...
this.params.filterChangedCallback();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With