我正在使用以下代码创建一个ag-grid。我想将rowSelection选项从单个按钮的onClick动态更改为多个onClick。
<ag-grid-angular
#validateGrid
style="width: 780px; height: 260px;"
class="ag-theme-balham"
rowSelection="single"
suppressRowClickSelection="false"
suppressHorizontalScroll="true"
[rowData]="rowData"
[columnDefs]="columnDefs"
[defaultColDef]="defaultColDef"
[getRowNodeId]="getRowNodeId"
(selectionChanged)="onSelectionChanged()"
(gridReady)="onGridReady($event)"
enableCellTextSelection=true>
</ag-grid-angular>
在我的Typescript代码中,我尝试了this.gridOptions.rowSelection = 'multiple';
,但这不起作用。有什么办法吗?
答案 0 :(得分:1)
尝试一下:
您的tmpl:
<ag-grid-angular
#validateGrid
style="width: 780px; height: 260px;"
class="ag-theme-balham"
rowSelection="{{rowSelection}}" // Updated
suppressRowClickSelection="false"
suppressHorizontalScroll="true"
[rowData]="rowData"
[columnDefs]="columnDefs"
[defaultColDef]="defaultColDef"
[getRowNodeId]="getRowNodeId"
(selectionChanged)="onSelectionChanged()"
(gridReady)="onGridReady($event)"
enableCellTextSelection=true>
</ag-grid-angular>
您的ts。
public rowSelection: string = 'single';
public changeRowSelection(): void {
this.rowSelection = 'multiple'; // this is example
}