Javascript &引用;未找到匹配的记录";表后剩余人口

Javascript &引用;未找到匹配的记录";表后剩余人口,javascript,datatables,angular-datatables,Javascript,Datatables,Angular Datatables,即使数据已加载,“未找到匹配记录”行仍保留在我的表中 该表定义如下: <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>

即使数据已加载,“未找到匹配记录”行仍保留在我的表中

该表定义如下:

<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>
关于它为什么会保留下来有什么想法吗?

按照说明 将以下代码放在src/styles.css(即您的全局样式)上


如果您使用Angular2或更高版本、组件级SCS或CSS(非全局级)


对于angular,使用此选项可在数据从后端到达后删除“未找到匹配记录”

      // 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();
          }
          // });
        });
      }

尝试为
表设置
datatable=“ng”
属性,请参见.@Gyrocode.com如果100%正确,则很容易复制案例。尝试在其中一列中进行排序,所有行都会消失,因为datatables不知道数据-它不知道angular已呈现该表。Cheers@Gyrocode.com已修复该问题。是否尝试了datatable.draw()方法?
  .dataTables_empty {
      display: none;
    } 
::ng-deep table.dataTable td.dataTables_empty {
            display: none;
        }
      // 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();
          }
          // });
        });
      }