Closed aleohli closed 4 years ago
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!
When switching between stories for the component that uses ngx-datatable component ViewDestroyedError appears. It appears only in the situation when switching between stories with changed table structure.
Simple example below:
Component that uses ng-datatable component: `import { Component, Input } from '@angular/core';
@Component({ selector: 'data-table', template:
<ngx-datatable class="material expandable" rowHeight="auto" headerHeight="auto" footerHeight="40" columnMode="force" [rows]="rows"> <ngx-datatable-column *ngIf = "multiSelection" [headerCheckboxable]="true" [checkboxable]="true"> </ngx-datatable-column> <ngx-datatable-column *ngFor="let column of columns" [prop]="column" [name]="column"> </ngx-datatable-column> </ngx-datatable>
, }) export class TableComponent { @Input() multiSelection: boolean; @Input() rows = []; columns = ['firstName', 'lastName']; }`And stories file: `const firstRowsVariant = [ {firstName: 'John', lastName: 'Smith'}, {firstName: 'Donald', lastName: 'Trump'}, {firstName: 'Barack', lastName: 'Obama'}, ];
const secondRowsVariant = [ {firstName: 'Donald', lastName: 'Trump'}, {firstName: 'Barack', lastName: 'Obama'}, ];
storiesOf('Components|Test', module).addDecorator( moduleMetadata({ imports: [TableModule] }) ).add( 'Multiselection enabled ver1', () => ({ component: TableComponent, props: { multiSelection: true, rows: firstRowsVariant } }), { notes: '' } ).add( 'Multiselection enabled ver2', () => ({ component: TableComponent, props: { multiSelection: true, rows: secondRowsVariant } }), { notes: '' } ).add( 'Multiselection disabled', () => ({ component: TableComponent, props: { multiSelection: false, rows: firstRowsVariant } }), { notes: '' } );`
Behaviour:
Error: