[英]Expandable nested Angular material data tables with pagination Not working as expected?
我有一個帶有標簽的嵌套表的要求,我使用的是 angular 材料。
分支數據(服務器端分頁)和兩個選項卡中的內表(客戶端分頁)也需要分頁
它沒有按預期工作,Pagigantion 正在為 0 索引應用一個,從第二個記錄我點擊第二個頁面分頁它正在更新第三個表,第三個 - > 第 4 個更新
我喜歡thease
//分支
分支源:MatTableDataSource;
@ViewChild('branchSort', { static: true }) 排序:MatSort;
@ViewChild(MatPaginator, { static: true }) branchPaginator: MatPaginator;
//tab1
@ViewChildren('innerTables') innerTables: QueryList<MatTable>;
@ViewChildren(MatPaginator) 分頁器:QueryList;
@ViewChildren('innerSort') 內部排序:查詢列表;
//tab2
@ViewChildren('innerTables1') innerTables1: QueryList<MatTable>;
@ViewChildren('innerSort1') 內部排序1:查詢列表;
@ViewChildren(MatPaginator) paginator1: QueryList;
建議我完成requiremnet的好方法。 提前致謝
我解決了我的問題
問題是 mat viewchild 參考
我像這樣修改了我的代碼
@ViewChild('branchSort', { static: true }) sort: MatSort;
@ViewChildren('innerSort') innerSort: QueryList<MatSort>;
@ViewChildren('innerSort1') innerSort1: QueryList<MatSort>;
@ViewChildren('innerTables') innerTables: QueryList<MatTable<any>>;
@ViewChildren('innerTables1') innerTables1: QueryList<MatTable<any>>;
@ViewChildren('paginator') paginator: QueryList<MatPaginator>;
@ViewChildren('paginator1') paginator1: QueryList<MatPaginator>;
@ViewChild(MatPaginator, { static: true }) batchPaginator: MatPaginator;
極好的!
只需在您的 stackblitz 行 344 this.branchSource.paginator = this.batchPaginator;
感謝分享
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.