У меня проблема с обновлением ячеек данных после запроса в пользовательский расширяемый компонент ячейки:
HTML:
<ag-grid-table [options]="optionsOrgViewRoutingRules"></ag-grid-table>
TS:
public optionsOrgViewRoutingRules: any = <any>{
icons: {
groupExpanded: '<i class="mdi mdi-arrow-expand mdi-24px" />',
groupContracted: '<i style="color: #428bca" class="mdi mdi-arrow-expand mdi-24px" />',
},
rememberGroupStateWhenNewData: true,
detailCellRenderer: 'myDetailCellRenderer',
masterDetail: true,
frameworkComponents: {
myDetailCellRenderer: RoutingRulesExpandableRowComponent, //CUSTOM COMPONENT
},
deltaRowDataMode: true,
getRowNodeId: (data: any): any => {
return data.id;
},
suppressCellSelection: true,
suppressContextMenu: true,
columnDefs: [
{
headerName: this.localization.getValue('orgViewer.tab.routingRules.ruleType'),
hide: false,
field: 'ruleType',
cellClass: 'applyInheritedRowStyleToSpecificRowCells',
suppressContextMenu: false,
type: ['stringColumnSenderProcessingReceiver'],
},
{
headerName: this.localization.getValue('orgViewer.tab.routingRules.ruleName'),
hide: false,
field: 'ruleName',
cellClass: 'applyInheritedRowStyleToSpecificRowCells',
cellRenderer: 'agGroupCellRenderer',
},
],
rowData: [],
rowSelection: 'single',
context: { componentParent: this },
};
Пользовательский расширяемый компонент:
HTML:
<table class="audit-activity-table">
<tr *ngFor="let specification of specifications">
<td>{{specification.type}}</td>
<td>{{specification.specification}}</td>
<td>{{specification.value}}</td>
<td>{{specification.operator}}</td>
</tr>
</table>
TS:
класс экспорта RoutingRulesExpandableRowComponent реализует ICellRendererAngularComp {
public specifications: any; // TODO: need interface
public actions: any; // TODO: need interface
public params: any;
public agInit(params: any): void {
const orgId: number = params.data.currentOrganizationId;
const ruleId: number = params.data.id;
this.rulesService
.getRule(orgId, ruleId)
.subscribe((data: any) => {
this.specifications = data.specifications;
this.actions = data.actions;
// PLACE TO REFRESH CELL
});
}
public refresh(params: any): boolean {
return false;
}
constructor(
public rulesService: RulesService,
) { }
}
После нажатия на значок расширения, я вижу только заголовки таблицы без данных.
Но после движения мыши данные появляются. WTF?
Как показать данные сразу? Я знаю о api.refreshCells (cellRefreshParams), но как мне его использовать?