question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Two tables on same page throwing error when sorting.

See original GitHub issue

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here

Current behavior If I have two tables on the same page and try sort the second table, an error is thrown. I am defining a ngx-datatable-column as I want to use a cell template.

Expected behavior Both tables should be sortable.

Reproduction of the problem Plunker does not seem to be working?

To create it is very simple. All I did was create two tables in the same component as follows:

<ngx-datatable [rows]="table1" [rowHeight]="'auto'" [columnMode]="'flex'">
	<ngx-datatable-column name="Customer" prop="customerNumber"> 
         </ngx-datatable-column>				
</ngx-datatable>
<ngx-datatable [rows]="table2" [rowHeight]="'auto'" [columnMode]="'flex'">
	<ngx-datatable-column name="Customer" prop="customerNumber"></ngx-datatable-column>				
</ngx-datatable>

This resulted in the following error when I click on the column header in the second table: EXCEPTION: Error in ./DataTableBodyComponent class DataTableBodyComponent - inline template:31:12 caused by: Expression has changed after it was checked. Previous value: ‘true’. Current value: ‘false’.

  • Table version: 6.0.0

  • Angular version: 2.3.1

  • Browser: Chrome

  • Language: TypeScript 2.1

Thanks, Kevin.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
pstahmercommented, Jul 3, 2017

Seeing the same issue as @ipassynk. It also occurs if subsets of the same row collection are used in multiple tables without being deep cloned. I forked the above plunkr to show an example of this case https://plnkr.co/edit/iDzItKhvp2QcfZBMMqH4?p=preview.

1reaction
ipassynkcommented, Apr 10, 2017

I don’t think it is related to the shared columns. It is related to the same row objects and in particular $index that is added to the grid. It would be nice to share the row objects and have custom $index for each grid. You can check the plunk https://plnkr.co/edit/i4ayUTOuYQnFgvqbIP2m that shows two grids with with different columns objects but the same rows. open the console and start clicking on sort. See the error.

DataTableBodyComponent.html:30 ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'datatable-body-row datatable-row-even'. Current value: 'datatable-body-row datatable-row-odd'.
    at viewDebugError (errors.ts:30) [angular]
    at expressionChangedAfterItHasBeenCheckedError (errors.ts:29) [angular]
    at checkBindingNoChanges (util.ts:145) [angular]
    at checkNoChangesNodeInline (view.ts:438) [angular]
    at checkNoChangesNode (view.ts:519) [angular]
    at debugCheckNoChangesNode (services.ts:387) [angular]
    at debugCheckRenderNodeFn (services.ts:330) [angular]
    at Object.eval [as updateRenderer] (DataTableBodyComponent.html:30) [angular]
    at Object.debugUpdateRenderer [as updateRenderer] (services.ts:307) [angular]
    at checkNoChangesView (view.ts:368) [angular]
    at callViewAction (view.ts:694) [angular]
    at execEmbeddedViewsAction (view.ts:670) [angular]
    at checkNoChangesView (view.ts:368) [angular]
    at callViewAction (view.ts:694) [angular]
    at ____________________Elapsed_46507_ms__At__Mon_Apr_10_2017_10_20_21_GMT_0400__EDT_ (localhost)
    at getStacktraceWithUncaughtError (VM1058 long-stack-trace-zone.js:39) [angular]
    at new LongStackTrace (VM1058 long-stack-trace-zone.js:33) [angular]
    at Object.onScheduleTask (VM1058 long-stack-trace-zone.js:104) [angular]
    at ZoneDelegate.scheduleTask (VM1039 zone.js:378) [angular]
    at Object.onScheduleTask (VM1039 zone.js:274) [angular]
    at ZoneDelegate.scheduleTask (VM1039 zone.js:378) [angular]
    at Zone.scheduleTask (VM1039 zone.js:209) [angular]
    at Zone.scheduleEventTask (VM1039 zone.js:235) [angular]
    at zoneAwareAddListener (VM1039 zone.js:1370) [angular]
    at HTMLSpanElement.addEventListener (eval at createNamedFn (VM1039 zone.js:1476), <anonymous>:3:43) [angular]
    at DomEventsPlugin.addEventListener (dom_events.ts:37) [angular]
    at EventManager.addEventListener (event_manager.ts:32) [angular]
    at DefaultDomRenderer2.listen (dom_renderer.ts:110) [angular]
    at DebugRenderer2.listen (services.ts:906) [angular]
    at ____________________Elapsed_168_ms__At__Mon_Apr_10_2017_10_20_21_GMT_0400__EDT_ (localhost)
    at getStacktraceWithUncaughtError (VM1058 long-stack-trace-zone.js:39) [angular]
    at new LongStackTrace (VM1058 long-stack-trace-zone.js:33) [angular]
    at Object.onScheduleTask (VM1058 long-stack-trace-zone.js:104) [angular]
    at ZoneDelegate.scheduleTask (VM1039 zone.js:378) [angular]
    at Object.onScheduleTask (VM1039 zone.js:274) [angular]
    at ZoneDelegate.scheduleTask (VM1039 zone.js:378) [angular]
    at Zone.scheduleTask (VM1039 zone.js:209) [angular]
    at Zone.scheduleMicroTask (VM1039 zone.js:229) [angular]
    at scheduleResolveOrReject (VM1039 zone.js:758) [angular]
    at resolvePromise (VM1039 zone.js:707) [angular]
    at unpkg.com/zone.js@0.8.5/dist/zone.js:760:17 [angular]
    at Object.onInvokeTask (ng_zone.ts:253) [angular]
    at ZoneDelegate.invokeTask (VM1039 zone.js:397) [angular]
    at ____________________Elapsed_3_ms__At__Mon_Apr_10_2017_10_20_21_GMT_0400__EDT_ (localhost)
    at getStacktraceWithUncaughtError (VM1058 long-stack-trace-zone.js:39) [angular]
    at new LongStackTrace (VM1058 long-stack-trace-zone.js:33) [angular]
    at Object.onScheduleTask (VM1058 long-stack-trace-zone.js:104) [angular]
    at ZoneDelegate.scheduleTask (VM1039 zone.js:378) [angular]
    at Object.onScheduleTask (VM1039 zone.js:274) [angular]
    at ZoneDelegate.scheduleTask (VM1039 zone.js:378) [angular]
    at Zone.scheduleTask (VM1039 zone.js:209) [angular]
    at Zone.scheduleMicroTask (VM1039 zone.js:229) [angular]
    at scheduleResolveOrReject (VM1039 zone.js:758) [angular]
    at ZoneAwarePromise.then (VM1039 zone.js:847) [angular]
    at new ApplicationInitStatus (application_init.ts:47) [angular]
    at AppModuleInjector.createInternal (module.ngfactory.js [sm]:1) [angular]
    at AppModuleInjector.NgModuleInjector.create (ng_module_factory.ts:124) [angular]
    at NgModuleFactory.create (ng_module_factory.ts:97) [angular]
Read more comments on GitHub >

github_iconTop Results From Across the Web

tablesorter problems with 2 table in a page
I try to put 2 tables in a same page using jquery plugin tablesorter .. But if do it, my second table does...
Read more >
When Using Multiple Tables, First Table Has Sorting Issues
I am having an issue which I did not have before. I am using multiple tables with blank id and class equals to...
Read more >
How to make tablesorting work with multiple tables on the ...
With Drupal 5.0 and beyond, it is now possible to provide independent sorting of tables when they appear on the same page.
Read more >
How To Break Out Large Tables Into Multiple ... - YouTube
How do you clean up a huge flat database file from SQL server into Power BI? This is a common question in the...
Read more >
How do I display two table unrelated tables on one layout?
Actually I just want to display data in sub summary when sorted by for each table so that I can, at a glance,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found