【发布时间】:2019-02-27 02:25:01
【问题描述】:
data.compnent.ts:
getData() {
this._dServices.downloadData().subscribe((value) => this.data = value);
setTimeout(function () {
const table: any = $('#myTable');
this.dataTable = table.DataTable({
'paging': true,
'ordering': true,
'info': true,
'columnDefs': [ {
'targets': 2,
'sortable': false
} ]
});
}, 800);
}
data.compnent.html:
<br>
<br>
<div class="container container-fluid">
<div class="">
<button class="btn btn-block btn-primary" (click)="getData()" > Get Started </button>
<br>
<table datatable dtOptions="dtOptions" class=" table row-border" id="myTable" >
<thead>
<tr>
<th> Score </th>
<th> News Title </th>
<th> URL </th>
</tr>
</thead>
<tbody>
<tr *ngFor="let a of data">
<td>{{a.score}}</td>
<td>{{a.title}}</td>
<td>{{a.url}}</td>
</tr>
</tbody>
</table>
</div>
</div>
详情##
我希望我的应用程序按照搜索应该执行的方式工作,直到用户输入多个字符,任何人都可以使用 jQuery DataTable 库为我提供解决方案。 排序和简单搜索效果很好。 请解决方法
【问题讨论】:
标签: jquery search datatables angular6