Questions tagged «ngx-datatable»

2
ngx-datatable行详细信息内的动态组件
我正在使用ngx-datatable创建可重用的数据表,并且希望在行详细信息内呈现动态组件。数据表组件从父模块接收一个组件类作为参数,我使用ComponentFactory来创建组件。我可以看到该构造函数和onInit方法正在为动态组件运行,但没有附加到DOM。 这就是datatable html的row-detail的样子: <!-- [Row Detail Template] --> <ngx-datatable-row-detail rowHeight="100" #myDetailRow (toggle)="onDetailToggle($event)"> <ng-template let-row="row" #dynamicPlaceholder let-expanded="expanded" ngx-datatable-row-detail-template> </ng-template> </ngx-datatable-row-detail> <!-- [/Row Detail Template] --> 这就是我的.ts文件的样子: @ViewChild('myDetailRow', {static: true, read: ViewContainerRef}) myDetailRow: ViewContainerRef; @ViewChild('dynamicPlaceholder', {static: true, read: ViewContainerRef}) dynamicPlaceholder: ViewContainerRef; renderDynamicComponent(component) { var componentFactory = this.componentFactoryResolver.resolveComponentFactory(component); var hostViewConRef1 = this.myDetailRow; var …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.