swimlane / ngx-datatable

✨ A feature-rich yet lightweight data-table crafted for Angular
http://swimlane.github.io/ngx-datatable/
MIT License
4.63k stars 1.68k forks source link

rowDetail async #1612

Open blhasan opened 5 years ago

blhasan commented 5 years ago

[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**
toggleExpandRow does not work! If I load row detail asynchronously.

**Expected behavior**

**Reproduction of the problem**
toggleExpandRow(row) {
    this.myService.getSingle(row.id).subscribe(
      res => {
        if (res["result"]["code"] == 200) {
         this.tableExp.rowDetail.toggleExpandRow(res["result"]["data"]);
        } 
      },
      error => {
      .......
      }
    );
}
* **Table version:** 
 "@swimlane/ngx-datatable": "12.0.0",

* **Angular version:** 
angular version : 6.0.0

* **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]
Typescript 2.7
sachin5590 commented 5 years ago

I am having the same problem, did you found solution to the problem.

eagor commented 5 years ago

Better to have additional component for row detail, that does the loading:

    <ngx-datatable-row-detail>
      <ng-template let-row="row" let-expanded="expanded" ngx-datatable-row-detail-template>
        <app-row-details [rowId]="row"></app-row-details>
      </ng-template>
    </ngx-datatable-row-detail>

And then inside the RowDetailsComponent do all the async fetching.

ItsAyushSomani commented 5 years ago

I am facing the same problem, Did someone found solution to this problem?