我想搜索ag-grid的行,如果有任何行的属性设置了especific值。应该使用GridApi函数的forEachNode还是最好的方法?
app.component.html
<form action="">
<table class="tg" id="tg">
<tr>
<td>id</td>
<td><input type="text" id="value1"></td>
</tr>
<tr>
<td>node name</td>
<td><input type="text" id="value2"></td>
</tr>
<tr>
<td>attribute</td>
<td><input type="text" id="value3"></td>
</tr>
<tr>
<td>attribute</td>
<td><input type="text" id="value3"></td>
</tr>
</table>
<div id="cnt"></div>
</form>
<div class="button">
<button id='btn_javascript' onclick="javascript_click();">자바스크립트</button>
</div>
app.component.ts
<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>
答案 0 :(得分:1)
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吗?
还是你们在处理同一问题?