我在声明如下的 vue.js 应用程序中有一个 ag-grid 组件:
<ag-grid-vue :enable-sorting="false"
:enable-filtering="false"
:suppressDragLeaveHidesColumns="true"
:rowData="category.policyDocuments"
:gridOptions="policyGridOptions"
@cellValueChanged="savePolicyRow"
@grid-ready="onPolicyGridReady($event, category)"
class="w-100"
style="height: 200px">
</ag-grid-vue>
绑定到这个打字稿视图模型:
export class PolicyListViewModel {
status: PolicyDashboardStatus;
policyLists: DocumentWalletPolicyDocumentList[] = [];
gridApi: GridApi | null = null;
policyDocuments: DocumentWalletDocumentViewModel[] = [];
constructor(status: PolicyDashboardStatus) {
this.status = status;
}
get shouldShow(): boolean {
return this.policyDocuments.length > 0;
}
updateDocuments(): void {
this.policyDocuments = this.policyLists
.map(list => list.policyDocuments)
.reduce((a, b) => a.concat(b), []);
}
}
当我的页面首次显示时,我得到了正确的数据。当我updateDocuments
用新数据调用时,网格不会更新。我已经在 vue devtools 中验证了该rowData
道具正在更新。ag-grid 文档建议组件应对更改做出反应。任何想法我做错了什么?