2
我正在使用ag网格制作项目。但我想在过滤器字段中获取来自用户的输入文本。我需要来自用户的过滤器的输入来进行http调用。我在网站上搜索,但无法得到答案。使用Angular 2中的ag网格中的过滤器字段的值
我正在使用ag网格制作项目。但我想在过滤器字段中获取来自用户的输入文本。我需要来自用户的过滤器的输入来进行http调用。我在网站上搜索,但无法得到答案。使用Angular 2中的ag网格中的过滤器字段的值
假设您正在使用Angular 2组件,请查看示例项目中的PartialMatchFilterComponent。
@Component({
selector: 'filter-cell',
template: `
Filter: <input style="height: 10px" #input (ngModelChange)="onChange($event)" [ngModel]="text">
`
})
class PartialMatchFilterComponent implements AgFilterComponent {
... rest of the class
中的onChange方法,你可以火了你的请求作为输入的用户(你可能会想添加某种反跳的位置):
onChange(newValue):void {
if (this.text !== newValue) {
this.text = newValue;
... fire off your http request here ...
this.params.filterChangedCallback();
}
}
谢谢你,这有助于我出去 – user2843943