网格列数据中的新行 table angular
New line in grid column data table angular
我有一个网格和一个列值,如下所示:
Column "DiskStatus"
"Mr c< br > Blue has < br >a blue house and< br > a blue car"
我正在尝试将
替换为“/n”,但它没有换行(请参阅下面的代码)
this.resultData.forEach(x=> x.DiskStatus=
x.DiskStatus.replace(//mg,'\n'));
如何在网格单元格中换行?
<table id="groups" class="table table-bordered table-hover dataTable" [mfData]="resultData" #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage"
[(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
<thead>
<tr role="row">
<th> <mfDefaultSorter by="HostName">Host Name</mfDefaultSorter></th>
<th><mfDefaultSorter by="CPUStatus">CPU Status</mfDefaultSorter></th>
<th><mfDefaultSorter by="DiskStatus">Disk Status</mfDefaultSorter></th>
</tr>
</thead>
<tbody *ngIf="resultData.length>0">
<tr *ngFor="let result of mf.data | filter:filter; let i = index">
<td>{{result.HostName}}</td>
<td>{{result.CPUStatus}}</td>
<td>{{result.DiskStatus}}</td>
</tr>
</tbody>
<tr *ngIf="resultData.length <=0"><td colspan="10"> No Data Found</td></tr>
<tfoot>
<tr>
<td colspan="8">
<mfBootstrapPaginator></mfBootstrapPaginator>
</td>
</tr>
</tfoot>
</table>
试试看
white-space: pre; /* o pre-wrap o pre-line */
关于 <td>
的样式
我有一个网格和一个列值,如下所示:
Column "DiskStatus"
"Mr c< br > Blue has < br >a blue house and< br > a blue car"
我正在尝试将
替换为“/n”,但它没有换行(请参阅下面的代码)
this.resultData.forEach(x=> x.DiskStatus= x.DiskStatus.replace(//mg,'\n'));
如何在网格单元格中换行?
<table id="groups" class="table table-bordered table-hover dataTable" [mfData]="resultData" #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage"
[(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
<thead>
<tr role="row">
<th> <mfDefaultSorter by="HostName">Host Name</mfDefaultSorter></th>
<th><mfDefaultSorter by="CPUStatus">CPU Status</mfDefaultSorter></th>
<th><mfDefaultSorter by="DiskStatus">Disk Status</mfDefaultSorter></th>
</tr>
</thead>
<tbody *ngIf="resultData.length>0">
<tr *ngFor="let result of mf.data | filter:filter; let i = index">
<td>{{result.HostName}}</td>
<td>{{result.CPUStatus}}</td>
<td>{{result.DiskStatus}}</td>
</tr>
</tbody>
<tr *ngIf="resultData.length <=0"><td colspan="10"> No Data Found</td></tr>
<tfoot>
<tr>
<td colspan="8">
<mfBootstrapPaginator></mfBootstrapPaginator>
</td>
</tr>
</tfoot>
</table>
试试看
white-space: pre; /* o pre-wrap o pre-line */
关于 <td>