javascript - 数据不可用时如何在表格上显示消息
问题描述
我创建了内联可编辑表。当数据不可用时,它应该“无记录显示。但我无法显示它。我试过这个:
<ng-template #viewable>
<ng-container *ngIf="data && data.length > 0; else noDataToShow">
<ng-container *ngFor="let head of headers">
<ng-container *ngIf="head.mappedProperty">
<td>
{{ head.dataType ==='dropDown' ? tableData[head.mappedName]: head.dataType ==='date' ?
(tableData[head.mappedProperty] | date: 'dd-MM-yyyy') : tableData[head.mappedProperty] }}
</td>
</ng-container>
</ng-container>
</ng-container>
<ng-template #noDataToShow> No Data to Show </ng-template>
</ng-template>
解决方案
一种可能的解决方案*matNoDataRow
:
<tr class="mat-row" *matNoDataRow>
<td class="mat-cell" colspan="9999">
No record display.
</td>
</tr>
推荐阅读
- java - 运行项目时获取 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- javascript - 简化写日期
- visual-studio - 未实现的错误(颤振)
- html - 图像网格图像中的问题
- javascript - 单击按钮时如何在另一个页面中弹出引导警报
- regex - 正则表达式匹配车把表达式和默认值
- python - Pandas:将浮点列转换为 int,同时保留 NaN
- xml - 很难使用 xmllint 在我的 xml 文件中搜索信息
- dax - 带滤波器的功率枢轴标准偏差
- javascript - 在节点js中的json文件中搜索和更新值