Open ghost opened 8 years ago
Same here, but clicking on any page other than "1". Tried in ffox & chrome.
just click any page then use filter
1) clic "Last" (page navigation) 2) in "filter" I wrote "aaa" (correctly dissapeared all rows) 3) delete filter 4) get next screen:
Tracked this down to the pagination component of ng2-bootstrap. The exact error is:
ORIGINAL EXCEPTION: Expression has changed after it was checked. Previous value: ''. Current value: '[object Object],[object Object],[object Object],[object Object],[object Object]'
I "fixed" this by changing ng2-bootstrap/components/pagination/pagination.component.js:73 from this.selectPage(this.page); to this.writeValue(this.page);
Trying to figure out the details next.
Same problem.. here.. but not necessarily last page.. It can happen at page 20 and you change the page size
This error occurs when changes happen during change detection, specifically in the onChangeTable
method from the demo code. A solution which fixes the problem is to explicitly notify about the change using ChangeDetectorRef.detectChanges()
as the last statement of onChangeTable():
import { ChangeDetectorRef } from '@angular/core';
public constructor( private ref: ChangeDetectorRef ) { }
public onChangeTable(config: any, page: any = { page: this.page, itemsPerPage: this.itemsPerPage }): any {
// Your logic to be executed on table change
this.ref.detectChanges();
}
It works !
Cool!! It's working!
When I try the solution offered by @tudorciotlos on Nov 23, I get this exception:
error_handler.js:50 EXCEPTION: Uncaught (in promise): Error: Error in ./LogsComponent class LogsComponent - inline template:0:12 caused by: Cannot read property 'config' of undefined TypeError: Cannot read property 'config' of undefined at DebugAppView.ViewLogsComponent0.detectChangesInternal (/AppModule/LogsComponent/component.ngfactory.js:330:36) at DebugAppView.AppView.detectChanges (http://localhost:4200/vendor.bundle.js:69471:14) at DebugAppView.detectChanges (http://localhost:4200/vendor.bundle.js:69666:44) at ViewRef.detectChanges (http://localhost:4200/vendor.bundle.js:50278:20) at LogsComponent.onChangeTable (http://localhost:4200/main.bundle.js:1439:18) at SafeSubscriber._next (http://localhost:4200/main.bundle.js:1356:81) at SafeSubscriber.__tryOrSetError (http://localhost:4200/vendor.bundle.js:575:16) at SafeSubscriber.next (http://localhost:4200/vendor.bundle.js:517:27) at Subscriber._next (http://localhost:4200/vendor.bundle.js:468:26) at Subscriber.next (http://localhost:4200/vendor.bundle.js:432:18) at BehaviorSubject._subscribe (http://localhost:4200/vendor.bundle.js:54424:24) at BehaviorSubject.Observable.subscribe (http://localhost:4200/vendor.bundle.js:50:27) at Observable._subscribe (http://localhost:4200/vendor.bundle.js:108:28) at Observable.subscribe (http://localhost:4200/vendor.bundle.js:50:27) at new LogsComponent (http://localhost:4200/main.bundle.js:1356:47)ErrorHandler.handleError @
This error happend when the total of results need less "pages" than the position for the actual page.
Steps to reproduce:
go to: http://valor-software.com/ng2-table/
In the example table, click on last button on the pagination menu
Go to filter input, type anything