首页 新闻 赞助 找找看

关于在anjular 下引用 Datatables插件功能失效的问题

0
悬赏园豆:100 [已关闭问题] 关闭于 2018-07-27 12:19

想在angular下使用Datatables插件,遇到了一个问题。引用后Datatables的一些功能失效了,对表格做排序,搜索,分页操作都会造成表格数据丢失,代码如图。

 1 <table id="myTable" class="table table-striped">
 2   <thead>
 3      <tr>
 4        <th>Billing code</th>
 5        <th>Engagement</th>
 6        <th>Booked hours</th>
 7        <th>Start date</th>
 8        <th>End date</th>
 9        <th>Content</th>
10        <th>GDS contact person</th>
11        <th>Status</th>
12        <th>Action</th>
13        <th>My feedback</th>
14      </tr>
15   </thead>
16   <tbody>
17      <tr *ngFor="let item of myReservation">
18       <td><a routerLink="/OrderDetail/{{item.BillingID}}" (click)="onSelect(item.PermissionInfo.PermissionID)">{{item.BillingID}}</a></td>
19       <td>{{item.Enagement}}</td>
20       <td>{{item.BookingHrs}}</td>
21       <td>{{item.BeginDate}}</td>
22       <td>{{item.EndDate}}</td>
23       <td>{{item.Content}}</td>
24       <td>{{item.ContactPerson}}</td>
25       <td>{{item.Status}}</td>
26       <td><a routerLink="/OrderDetail/{{item.BillingID}}" (click)="onSelect(item.PermissionInfo.PermissionID)">{{item.PermissionInfo.DisplayName}}</a></td>
27       <td></td>
28      </tr> 
29    </tbody>
30 </table>

引用datatables

 ngOnInit() {
    $(document).ready(function(){
      $('#myTable').DataTable();
    });
  }

想请教一下这是什么原因造成的呢。有什么解决方法呢?

神勇的小熊的主页 神勇的小熊 | 菜鸟二级 | 园豆:202
提问于:2018-07-27 12:05
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册