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.

Ngx-Data table display empty row

See original GitHub issue

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

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

Current behavior I have Used Ngx Data table for Displaying data in table. I am fetching data from WEB API , API Returns correct data , but ngx data table displaces blank data , it display correct no of rows , but cell value blank , am i missing any bindings?

https://plnkr.co/edit/l3yBOwtxSKhDwffAEx7S?p=preview

image

I have written below code 👍 this.fetch(data => { // cache our list this.temp = […data]; this.rows = data; });

fetch(cb) { const req = new XMLHttpRequest(); req.open(“GET”, http://localhost/RealEstateAPI/api/LocationInfoes/GetCities); debugger

req.onload = () => {
    debugger
  cb(JSON.parse(req.response));
};
req.send();

}

<ngx-datatable #table style=“width: 100%” class=“material” [rows]=“rows” [columnMode]=“‘force’” [headerHeight]=“50” [footerHeight]=“50” [rowHeight]=“‘auto’” [limit]=“10” [selected]=“selected” [selectionType]=“‘checkbox’” (activate)=“onActivate($event)” (select)=‘onSelect($event)’> <ngx-datatable-column [width]=“60” [sortable]=“false” [canAutoResize]=“false” [draggable]=“false” [resizeable]=“false”> <ng-template ngx-datatable-header-template let-value="value" let-allRowsSelected="allRowsSelected" let-selectFn="selectFn"> <md-checkbox class=“example-margin” [checked]=“allRowsSelected” (change)=“selectFn(!allRowsSelected)”></md-checkbox> </ng-template> <ng-template ngx-datatable-cell-template let-value="value" let-isSelected="isSelected" let-onCheckboxChangeFn="onCheckboxChangeFn"> <md-checkbox class=“example-margin” [checked]=“isSelected” (change)=“onCheckboxChangeFn($event)”></md-checkbox> </ng-template> </ngx-datatable-column> <ngx-datatable-column name="ID"></ngx-datatable-column> <ngx-datatable-column name="Name"></ngx-datatable-column> <ngx-datatable-column name="Remark"></ngx-datatable-column> <ngx-datatable-column name="Edit"> <ng-template let-row="row" ngx-datatable-cell-template> </ng-template> </ngx-datatable-column> </ngx-datatable>

Expected behavior

Reproduction of the problem

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • Table version: 0.8.x

  • Angular version: 2.0.x

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
  • Language: [all | TypeScript X.X | ES6/7 | ES5]

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

14reactions
wizarrccommented, Sep 10, 2017

@ThakkarKhushbu I might have found the bug. This library moved to OnPush change detection at version 10.0.4. https://github.com/swimlane/ngx-datatable/blob/master/docs/changelog.md#1004

constructor() {
    this.fetch((data) => {
        this.rows.push(...data);
        this.rows = [...this.rows]; // Refresh the data
    });
}
4reactions
tusharkudalcommented, Sep 20, 2017

Try using this

      <ngx-datatable-column prop = "first_name" name="Name"></ngx-datatable-column>
      <ngx-datatable-column prop="user_dept" name="Department"></ngx-datatable-column>
      <ngx-datatable-column prop="group_name" name="Group"></ngx-datatable-column>

I was facing the same issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add Custom No Data To Display for ngx-datatable
I don't want the no data to display that comes with ngx-datatable. What i tried is below <div *ngIf="showTable"> <ngx-datatable [rows]="rows"> ...
Read more >
Ngx -data table Display Empty rows - Plunker
... <title>angular2 playground</title> <link rel="stylesheet" type="text/css" href="https://unpkg.com/@swimlane/ngx-datatable@4.1.0/release/datatable.css" ...
Read more >
swimlane/ngx-datatable - Gitter
I'm trying to implement an infinit scroller with ngx-datatable but I'm having issues displaying the rows on init. All I get is an...
Read more >
Datatable Empty Row Addition - StackBlitz
Starter project for Angular apps that exports to the Angular CLI.
Read more >
How To Use Ngx-Datatable To Show The Data In Grid View ...
rows : any = [];; totalCount: Number = 0;; closeResult: string;; dataParams: any = {; page_num: ...
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