2

データがロードされたにもかかわらず、「一致するレコードが見つかりません」という行がテーブルに残ります。

残りのテキスト

テーブルは次のように定義されます。

<table  datatable dt-options="gvc.dtOptions" class="table table-striped">
<thead>
<tr>
    <th data-priority="1">Alert Time</th>
    <th data-priority="2">Description</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="alert in gvc.recentAlerts">
    <td>{{alert.alert_time}}</td>
    <td>{{alert.sent_text}}</td>
</tr>
</tbody>

そして、コントローラーの dtOptions は次のとおりです。

    self.dtOptions = DTOptionsBuilder.newOptions()
  .withDOM('t')
  .withOption('scrollY', '200px')
  .withOption('scrollCollapse', true)
  .withOption('paging', false)
  .withOption('bSort', false)
  .withOption('responsive', true);

なぜそれが残っているのかについてのアイデアはありますか?

4

4 に答える 4

3

Angular2 以上、コンポーネント レベルの SCSS または CSS (グローバル レベルではない) を使用している場合は、

::ng-deep table.dataTable td.dataTables_empty {
            display: none;
        }
于 2020-06-08T08:07:22.350 に答える
0

角度の場合、これを使用して、データがバックエンドから到着した後に「一致するレコードが見つかりません」を削除します

      // Remove "No matching records found" 
      if (this.dtElement && this.sellers.length > 0) {
        this.dtElement.dtInstance.then((dtInstance: DataTables.Api) => {
          // dtInstance.on('draw.dt', function () {
          if ($('.dataTables_empty').length > 0) {
            $('.dataTables_empty').remove();
          }
          // });
        });
      }
于 2020-12-08T12:38:36.473 に答える