DataTable показывает нулевое сообщение с данными даже при появлении данных (Angular) - PullRequest
1 голос
/ 27 января 2020

ngAfterViewInit() {

  this.listarPromocoes()

  $('#datatables').DataTable({
    "pagingType": "full_numbers",
    "lengthMenu": [
      [10, 25, 50, -1],
      [10, 25, 50, "All"]
    ],
    responsive: true,
    language: {
      search: "_INPUT_",
      searchPlaceholder: "Search records",
    }

  });

  const table = $('#datatables').DataTable();
<div class="material-datatables">
  <table id="datatables" class="table  table-no-bordered " cellspacing="0" width="100%" style="width:100%">
    <thead>
      <tr>
        <th>Nome da promoção</th>
        <th>Data de ínicio</th>
        <th>Data de término</th>
        <th>Notificações</th>
        <th>Cliques</th>
        <th>Visualizações</th>
      </tr>
    </thead>
    <tbody>
      <tr *ngFor="let promocao of promocoes">
        <td>{{promocao.titulo}}</td>
        <td>{{promocao.dataInicio}}</td>
        <td>{{promocao.dataTermino}}</td>
        <td>{{promocao.notificacoes}}</td>
        <td>{{promocao.cliques}}</td>
        <td>{{promocao.visualizacoes}}</td>
        <td class="text-right">
          <i style="cursor: pointer;" (click)="alterarPromocao(promocao.guidpromocao)" class="material-icons">edit</i>
        </td>
      </tr>
    </tbody>
  </table>
</div>

enter image description here

Даже при загрузке данных сообщение «ноль данных» остается на экране , Я не знаю, заключается ли проблема в том, как я загружаю данные в таблицу, или мне нужно настроить некоторые параметры таблицы

...