Angular 如何在垫料台角料分拣时显示确认
我使用的是带角材料8的角材料8,我想在垫子上显示排序时的确认。 如果用户确认为真,图标将更改;如果用户确认为假,图标不会更改。 我该怎么做??请帮助解决此问题Angular 如何在垫料台角料分拣时显示确认,angular,angular-material,Angular,Angular Material,我使用的是带角材料8的角材料8,我想在垫子上显示排序时的确认。 如果用户确认为真,图标将更改;如果用户确认为假,图标不会更改。 我该怎么做??请帮助解决此问题 如果我理解正确,您的要求是要求用户在调用函数对数据进行排序之前确认排序 如果是,您有两个选择: 创建自定义指令以“手动”处理排序 如果用户取消最后一个排序事件,则将其保存为可能的“回滚”操作 下面是第二个例子。方法: @Component({ // ... }) export class TableSortingExample
如果我理解正确,您的要求是要求用户在调用函数对数据进行排序之前确认排序 如果是,您有两个选择:
- 创建自定义指令以“手动”处理排序李>
- 如果用户取消最后一个排序事件,则将其保存为可能的“回滚”操作
下面是第二个例子。方法:
@Component({
// ...
})
export class TableSortingExample {
@ViewChild(MatSort, { static: true }) sort: MatSort;
lastSort: Partial<Sort> = {};
sortChangeHandler(evt: Sort): void {
if (confirm('Confirm question?')) {
this.lastSort = {
active: this.sort.active,
direction: this.sort.direction
};
// Perform sort operation
} else {
this.sort.active = this.lastSort.active;
this.sort.direction = this.lastSort.direction;
}
}
}
@组件({
// ...
})
导出类表排序示例{
@ViewChild(MatSort,{static:true})sort:MatSort;
lastSort:Partial={};
sortChangeHandler(evt:Sort):void{
如果(确认(“确认问题”)){
this.lastSort={
活动:this.sort.active,
方向:this.sort.direction
};
//执行排序操作
}否则{
this.sort.active=this.lastSort.active;
this.sort.direction=this.lastSort.direction;
}
}
}
如果我理解正确,您的要求是要求用户在调用函数对数据进行排序之前确认排序 如果是,您有两个选择:
- 创建自定义指令以“手动”处理排序李>
- 如果用户取消最后一个排序事件,则将其保存为可能的“回滚”操作
下面是第二个例子。方法:
@Component({
// ...
})
export class TableSortingExample {
@ViewChild(MatSort, { static: true }) sort: MatSort;
lastSort: Partial<Sort> = {};
sortChangeHandler(evt: Sort): void {
if (confirm('Confirm question?')) {
this.lastSort = {
active: this.sort.active,
direction: this.sort.direction
};
// Perform sort operation
} else {
this.sort.active = this.lastSort.active;
this.sort.direction = this.lastSort.direction;
}
}
}
@组件({
// ...
})
导出类表排序示例{
@ViewChild(MatSort,{static:true})sort:MatSort;
lastSort:Partial={};
sortChangeHandler(evt:Sort):void{
如果(确认(“确认问题”)){
this.lastSort={
活动:this.sort.active,
方向:this.sort.direction
};
//执行排序操作
}否则{
this.sort.active=this.lastSort.active;
this.sort.direction=this.lastSort.direction;
}
}
}
您可以通过调用此类的sortData方法删除指令排序并实现自定义排序。您可以通过调用此类的sortData方法删除指令排序并实现自定义排序