如何解决bootstrap4 angular8数据表不适用于ngfor循环
我正在使用带有bootstrap4的数据表来显示动态数据。但是当我将其与静态数据一起使用时,它可以进行搜索和排序。当我将其放入for循环中时,它不起作用。
import { Component,Input,OnChanges } from "@angular/core";
@Component({
selector: "child-component",templateUrl: "./child-component.html"
})
export class MyComponent implements OnChanges {
@Input() someHtml: string;
constructor() {}
ngOnChanges() {
///** WILL TRIGGER WHEN PARENT COMPONENT UPDATES '**
console.log(this.someHtml);
}
}
如果我将其与for循环一起使用,则排序和搜索将无法工作。但是数据会填充。
<table datatable [dtOptions]="dtOptions" class="row-border hover">
<thead>
<tr>
<th>ID</th>
<th>First name</th>
<th>Last name</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Foo</td>
<td>Bar</td>
</tr>
</tbody>
</table>
当我单击“排序”或搜索任何内容时,所有数据都会消失。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。