Ag-Grid - 搜索具有确定条件的行
Ag-Grid - Search a row with determined condition
我想在 ag-grid 的行中搜索,如果有任何行 属性 设置了特定值。我应该使用 GridApi 函数的 forEachNode 还是有更好的方法?
app.component.html
<button [disabled]="disableButtons">Disable me</button>
<ag-grid-angular
#agGrid
style="width: 500px; height: 500px;"
class="ag-theme-balham"
[enableSorting]="true"
[enableFilter]="true"
[rowData]="rowData | async"
[columnDefs]="columnDefs"
rowSelection="multiple"
(selectionChanged) = 'onSelectionChanged($event)'>
</ag-grid-angular>
app.component.ts
onSelectionChanged(event: any){
var rows = this.agGrid.api. ????? ;
//any row with property A with value 'XY' ?
this.disableButtons = ????;
}
onSelectionChanged(event: any){
var rows = this.agGrid.api.getSelectedRows().filter(item=> return item.ExamleFieldName == "exampleValue");
//any row with property A with value 'XY' ?
this.disableButtons = rows.length > 0;
}
也是your post吗?
或者你们在处理同样的问题?
我想在 ag-grid 的行中搜索,如果有任何行 属性 设置了特定值。我应该使用 GridApi 函数的 forEachNode 还是有更好的方法?
app.component.html
<button [disabled]="disableButtons">Disable me</button>
<ag-grid-angular
#agGrid
style="width: 500px; height: 500px;"
class="ag-theme-balham"
[enableSorting]="true"
[enableFilter]="true"
[rowData]="rowData | async"
[columnDefs]="columnDefs"
rowSelection="multiple"
(selectionChanged) = 'onSelectionChanged($event)'>
</ag-grid-angular>
app.component.ts
onSelectionChanged(event: any){
var rows = this.agGrid.api. ????? ;
//any row with property A with value 'XY' ?
this.disableButtons = ????;
}
onSelectionChanged(event: any){
var rows = this.agGrid.api.getSelectedRows().filter(item=> return item.ExamleFieldName == "exampleValue");
//any row with property A with value 'XY' ?
this.disableButtons = rows.length > 0;
}
也是your post吗?
或者你们在处理同样的问题?