2

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);
}
shrey shah
  • 91
  • 2
  • 11

1 Answers1

0

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

  • 1
    In ng2-smart-table the header of the table is not getting updated, it's some issue with the table itself, not with something related to UI not updating in angular – shrey shah Dec 17 '20 at 09:12