mariuszfoltak/angular2-datatable

Multiple datatable

Closed this issue · 1 comments

Hi
Great datatable .

I have a problem with multiple datatables in the same component. #50
For this to work I need to change the intervnal variable from

#mf="mfDataTable"
to
#registreringerTable="mfDataTable"

One of the tables is listet below.
It works except for the sorting. What am I doing wrong?
Thanks in advance

regards Anders Gram Mygind

<table class="table-bordered" [mfData]="registreringer" #registreringerTable="mfDataTable" [mfRowsOnPage]="1000" [mfSortBy]="'Oprettet'" [mfSortOrder]="'desc'">
                                <thead>
                                    <tr>
                                        <th style="width: 15%">
                                            <mfDefaultSorter by="Sag?.Sagsnummer">Sagsnummer</mfDefaultSorter>
                                        </th>
                                        <th style="width: 40%">
                                            <mfDefaultSorter by="Sag?.Titel">Sagstitel</mfDefaultSorter>
                                        </th>
                                        <th style="width: 10%">
                                            <mfDefaultSorter by="Firma?.Navn">Firma</mfDefaultSorter>
                                        </th>
                                        <th style="width: 10%">
                                            <mfDefaultSorter by="Person?.Navn">Person</mfDefaultSorter>
                                        </th>
                                        <th style="width: 15%">
                                            <mfDefaultSorter by="OprettetAf?.Navn">Sagsansvarlig</mfDefaultSorter>
                                        </th>
                                        <th style="width: 10%">
                                            <mfDefaultSorter by="Oprettet">Oprettet</mfDefaultSorter>
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr *ngFor="let item of registreringerTable.data" (click)="onActivateDocument(item)" id={{item.Id}}>
                                        <td>{{item.Sag?.Sagsnummer}}</td>
                                        <td>{{item.Sag?.Titel}}</td>
                                        <td>{{item.Firma?.Navn}}</td>
                                        <td>{{item.Person?.Navn}}</td>
                                        <td>{{item.OprettetAf?.Navn}}</td>
                                        <td>{{item.Oprettet | date:'dd-MM-yyyy HH:mm:ss'}}</td>
                                    </tr>
                                </tbody>
                            </table>

I found out myself changing
<mfDefaultSorter by="Sag?.Sagsnummer">Sagsnummer</mfDefaultSorter>
to
<mfDefaultSorter by="Sag.Sagsnummer">Sagsnummer</mfDefaultSorter>