Dynamically update settings Ng2-smart-table

894 views Asked by At

I want to update 'hideSubHeader' value after button click. The value in settings for 'hideSubHeader' gets updated but it does not reflect on my smart table.

My Settings,

settings = {
    hideSubHeader: true
}

After button click,

newSettings() {
    const customSettings = settings;
    customSettings.hideSubHeader = false;
    this.settings = Object.assign({}, customSettings);
}
1

There are 1 answers

1
Никита Середа On

u can use next:

constructor(private cdr: ChangeDetectorRef) {...}

this.cdr.markForCheck(); // in place where u change some settings

or if u set changeDetection: ChangeDetectionStrategy.OnPush in component settings, make it "Default" or remove row with that settings