使用角度材料从 mat-list 中删除所选项目在角度 2 中不起作用 [英] Deleting selected items from mat-list not working in angular 2 using angular material
问题描述
我已经使用角度材料在角度 2 中实现了一个简单的表格..实现了两种方法,首先是 transferSelectedRows,它在从表格中选择行时将行数据推送到 Selected Rows 部分.
第二种方法是 removeSelectedRows 选择行并单击 Remove SelectedRows 按钮应删除相应的列表项.但我无法从 mat-selection-list...
谁能帮我...!
请在此处访问我的示例示例 ..
您可以修改您的removeSelectedRows()
来过滤表格中的选定项目:
removeSelectedRows() {this.selection.selected.forEach(item => {this.selectedRows = this.selectedRows.filter(element => element !== item);});}
I have implemented a simple table in angular 2 using angular material ..Implemented two methods , first is transferSelectedRows which on selecting rows from table pushes the row data to Selected Rows section.
Second method is removeSelectedRows where on selecting the rows and clicking Remove Selected Rows button should delete the corresponding list items.But I am unable to delete the items from the mat-selection-list...
Can anybody please help me out ...!
please access my sample example here ..https://stackblitz.com/edit/angular-nwjqsj-au6ho8?file=index.html
Below shown is the output of my sample angular 2 app.
You can modify your removeSelectedRows()
to filter the selected items in the table:
removeSelectedRows() {
this.selection.selected.forEach(item => {
this.selectedRows = this.selectedRows.filter(element => element !== item);
});
}
这篇关于使用角度材料从 mat-list 中删除所选项目在角度 2 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!