Javascript 如何使用预处理扩展/折叠组?
我只是尝试使用priming在代码中的所有组中添加两个按钮展开和折叠。这是我的工作代码:Javascript 如何使用预处理扩展/折叠组?,javascript,angular,typescript,primeng,Javascript,Angular,Typescript,Primeng,我只是尝试使用priming在代码中的所有组中添加两个按钮展开和折叠。这是我的工作代码: {{rowData.room}-INFO 使用expandedRowsGroups属性,并为其分配一个数组,其中包含要显示或不显示的组标题 expandedRowsGroups:组字段值的集合,默认情况下显示已展开的组 单击按钮时填充或取消填充expandedGroups数组: expandAll() { this.expandedGroups = []; this.expande
{{rowData.room}-INFO
使用expandedRowsGroups
属性,并为其分配一个数组,其中包含要显示或不显示的组标题
expandedRowsGroups:组字段值的集合,默认情况下显示已展开的组
单击按钮时填充或取消填充
expandedGroups
数组:
expandAll() {
this.expandedGroups = [];
this.expandedGroups.push('ROOM1');
this.expandedGroups.push('ROOM2');
this.expandedGroups.push('ROOM3');
}
collapseAll() {
this.expandedGroups.pop('ROOM1');
this.expandedGroups.pop('ROOM2');
this.expandedGroups.pop('ROOM3');
}
<button (click)="expandAll()">Expand all</button>
<button (click)="collapseAll()">Collapse all</button>
和相关按钮:
expandAll() {
this.expandedGroups = [];
this.expandedGroups.push('ROOM1');
this.expandedGroups.push('ROOM2');
this.expandedGroups.push('ROOM3');
}
collapseAll() {
this.expandedGroups.pop('ROOM1');
this.expandedGroups.pop('ROOM2');
this.expandedGroups.pop('ROOM3');
}
<button (click)="expandAll()">Expand all</button>
<button (click)="collapseAll()">Collapse all</button>
全部展开
全部崩溃
见工作
默认情况下,如何展开它们?我的意思是当页面第一次加载时,我希望它们是expanded@progx在构造函数中调用expandAll方法(请参阅my Plunker的新版本)您能提供Plunker吗?Thanks@progx我加了一个砰砰的一声,成功了:)!您是否知道如何更改默认箭头图标?当一行展开时,我想使用class=“fa-fa-plus-square”,当一行折叠时,我想使用class=“fa-fa-plus-square”使用字体awesome对组件进行以下小改动:样式:[`:host/deep/.fa-chevron-circle right:before{content:\\\f0fe”}:host/deep/.fa chevron-circle-down:before{content:\\f147“`]
expandAll(dt: DataTable) {
dt['expandedRowsGroups'] = [];
Object.keys(dt.rowGroupMetadata).forEach((row)=>{
dt['expandedRowsGroups'].push(row);
});
}
expandAll(dt: DataTable) {
dt['expandedRowsGroups'] = [];
}