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.

let-rowIndex not working in <ngx-datatable-row-detail>

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

Current behaviour

Using ngx-datatable 11.3.2. I did read and learn from issue #992; the defect is still there.

This a sample snippet which manifests the problem:

                <ngx-datatable-row-detail #detailRow
                                          [rowHeight]="'auto'">
                    <ng-template let-row='row'
                                 let-expanded='expanded'
                                 let-rowIndex='rowIndex'
                                 ngx-datatable-row-detail-template>
                        <div style='padding-left: 35px;'>
                            <div class='nav-tabs-custom'>
                                <ul class='nav nav-tabs'>
                                    <li class='active'><a href='#tab_{{rowIndex}}_1'
                                           data-toggle='tab'
                                           aria-expanded='true'>Diagnostic Output</a></li>
                                    <li class=''><a href='#tab_{{rowIndex}}_2'
                                           data-toggle='tab'
                                           aria-expanded='false'>Error Output</a></li>
                                    <li class=''><a href='#tab_{{rowIndex}}_3'
                                           data-toggle='tab'
                                           aria-expanded='false'>Job Definition</a></li>
                                </ul>
                                <div class='tab-content'>
                                    <div class='tab-pane active'
                                         id='tab_{{rowIndex}}_1'>
                                        <div ace-editor
                                             [text]='row.stdOut'
                                             [mode]="'text'"
                                             [theme]="'idle_fingers'"
                                             [options]='options'
                                             [readOnly]='true'>
                                        </div>
                                    </div>
                                    <div class='tab-pane'
                                         id='tab_{{rowIndex}}_2'>
                                        <div ace-editor
                                             [text]='row.stdError'
                                             [mode]="'text'"
                                             [theme]="'idle_fingers'"
                                             [options]='options'
                                             [readOnly]='true'>
                                        </div>
                                    </div>
                                    <div class='tab-pane'
                                         id='tab_{{rowIndex}}_3'>
                                        <div ace-editor
                                             [text]='row.jobDefJSON'
                                             [mode]="'json'"
                                             [theme]="'idle_fingers'"
                                             [options]='options'
                                             [readOnly]='true'>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </ng-template>

All tabs have the same id in each row.

1st row: tab_0_1, tab_0_2, tab_0_3 2nd row: tab_0_1, tab_0_2, tab_0_3 <== should be tab_1_1, tab_1_2, tab_1_3

Expected behaviour

Would like rowIndex to be working.

Reproduction of the problem

Use the above snippet.

Please tell us about your environment:

  • Table version: 11.3.2

  • Angular version: 5.2.10

  • Browser: Chrome 66

  • Language: TypeScript 2.8.3

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:6
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
smasalacommented, Mar 11, 2019

Workaround:

@ViewChild(DatatableComponent)      // import {DatatableComponent} from '@swimlane/ngx-datatable';
private readonly table: DatatableComponent;

public getRowIndex(row: any): number {
    return this.table.bodyComponent.getRowIndex(row);   // row being data object passed into the template
}
<ng-template let-row="row" ngx-datatable-row-detail-template>
    {{ getRowIndex(row) }}
</ng-template>
0reactions
cassiodslcommented, Sep 9, 2020

@smasala thank you for your comment, very helpful! it worked 100%!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ngx-Datatable Access rowIndex in columns - Stack Overflow
I think you wouldn't be able to access the rowIndex where you are trying to access it. Here's a stackblitz which surely solves...
Read more >
swimlane/ngx-datatable - Gitter
I'm trying to debug swimlane/ngx-datatable#927 it would be useful to see how many issues are related to "build" or "integration" issues rather than...
Read more >
Changelog - ngx-datatable - GitBook
Bug: do not collapse row details when row updated (#1778) ... Fix: Fixes issue where footer pagination does not work when virtual scrolling...
Read more >
How to use Ngx Datatable in Angular 5 - Oodles Technologies
How to use and install ngx-datatable in our Application. ngx-datatable for ... Row Detail View. ... </ngx-datatable> <ng-template #rowIndex let-row='row' ...
Read more >
ngx-datatable - Angular component for presenting large and ...
Angular datatable for handling large and complex datasets in table ... Row Grouping; Fluid Row Height; Fixed Row Height; Dynamic Row Height; Row...
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