Ngx-datatable: Cannot read property 'toLocaleString' of undefined

Created on 2 Jun 2017  路  9Comments  路  Source: swimlane/ngx-datatable

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request
[ ] support request

Current behavior
An error is thrown when using the pagination:

Cannot read property 'toLocaleString' of undefined
    at Object.eval [as updateRenderer] (DataTableFooterComponent.html:20)
    at Object.debugUpdateRenderer [as updateRenderer] (services.ts:307)
    at checkAndUpdateView (view.ts:392)
    at callViewAction (view.ts:700)
    at execEmbeddedViewsAction (view.ts:670)
    at checkAndUpdateView (view.ts:389)
    at callViewAction (view.ts:700)
    at execComponentViewsAction (view.ts:644)
    at checkAndUpdateView (view.ts:392)
    at callViewAction (view.ts:700)

Expected behavior
No errors

Reproduction of the problem
The problem is reproduced in this Angular Quickstart repository: https://github.com/Neverminder/quickstart

What is the motivation / use case for changing the behavior?
The bug makes the table unusable and breaks the whole application.

Please tell us about your environment:
Ubuntu 16.04, IntelliJ Ultimate 2017, npm

  • Table version: 9.3.0
    Still exists in the latest version.

  • Angular version: 4.1.3
    Yes.

  • Browser: [all | Chrome 58

  • Language: TypeScript 2.3.1

Most helpful comment

Actually my count wasn't set. It was undefined and defined it became after loading data from server.

All 9 comments

Also encountered with this issue when using the latest version @9.3.0

@Neverminder @michalzfania

Ensure to set 'count' input if you are enabling 'externalPaging' on ngx-datatable. You may like to set 'count' to total number of row matching your qualification which is typically returned by the REST api you will be calling.

Hope it helps.

Same problem. Count is set of course.

Actually my count wasn't set. It was undefined and defined it became after loading data from server.

For my case, the count is set but not initialized. After initializing it to 0, problem solved.

+1 for better error message

+1 I also need that problems when I use page pagination on server side it seem that function run first before we get the data from the server using http. hope someone can find the solution and shared it here.thanks.

if you are using angular , just at the constructor of the component make the total count value of the variable to 0.

This is what that for the ngx directive parameters . You should set the variable that goes to the [offset],

 ` [externalPaging]="true" 
  [count]="page.totalElements" 
  [offset]="page.pageNumber"
  [limit]="page.size" `

Bu Sorunu 脟枚zmek 陌莽in Sanal Sunucunuza Node +8 Kurabilirsiniz :)

Was this page helpful?
0 / 5 - 0 ratings