Why is my datatable gone when I refresh my data after I have changed the language

Why is my datatable gone when I refresh my data after I have changed the language

frontendplacefrontendplace Posts: 8Questions: 2Answers: 0

The situation: I have a datatable created with datatable="ng" and dt-options

           <table id="ioRelationTable" datatable="ng" class="table hover" dt-options="vm.dtOptions" dt-column-defs="vm.dtColumnDefs">
                <thead>
                <tr>
                    <th>{{ "COL1" | translate }}</th>
                    <th>{{ "COL2" | translate }}</th>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="rel in vm.datalist">
                    <td>{{ rel.col1 }}</td>
                    <td>{{ rel.col2 }}</td>
                </tr>
                </tbody>
            </table>

In the dt-options I have defined the language as a reference to a json file:

           vm.dtOptions = DTOptionsBuilder
                .newOptions()
                .withDOM('<"pull-right l-ml-1"B>lftrip')
                .withPaginationType('simple_numbers')
                .withDisplayLength(25)
                .withLanguageSource('i18n/dt_' + $rootScope.language.id + '.json')
                .withButtons([
                    'csv',
                    'excel'
                ]);

            vm.dtColumnDefs = [
                DTColumnDefBuilder.newColumnDef(0),
                DTColumnDefBuilder.newColumnDef(1).notSortable()
            ];

When I change the language in my rootscope the labels gets translated. But if I change the vm.datalist after this the whole table is gone. Why? When i dont use the datatable directive the table gets renderend

Answers

This discussion has been closed.