angular - 完整的 ng-table (排序、搜索) not workink angular 10
问题描述
我正在尝试使用完整的 ng-table,但它不适用于 angular 10。
当我尝试复制粘贴代码时,此处出现错误
@Directive({
selector: 'th[mzSortable]',
host: {
'[class.asc]': 'direction === "asc"',
'[class.desc]': 'direction === "desc"',
'(click)': 'rotate()'
}
})
我试着用这个......
@Input() sortable: SortColumn = '';
@Input()
direction: SortDirection = '';
@Input()
@HostBinding('class.asc')
get ascClass (): any {
return this.direction === 'asc';
}
@Input()
@HostBinding('class.desc')
get descClass (): any {
return this.direction === 'desc';
}
@Output() sort = new EventEmitter<SortEvent>();
@HostListener('click')
rotate(): void {
this.direction = rotate[this.direction];
this.sort.emit({column: this.sortable, direction: this.direction});
}
现在表格出现了,但我无法对表格进行排序
解决方案
我找到了,问题是我更改了指令前缀。替换了这个:
@Directive({
selector: 'th[mzSortable]',
}
})
这样:
@Directive({
selector: 'th[sortable]',
}
})
推荐阅读
- c# - 表单未在 MVC 视图中正确呈现
- c# - 将 Outlook 代码从 VBScript 转换为 C#
- javascript - React Js without Api How To use in FrameWork like Spring, Laravel
- typescript - 键入工厂函数
- java - SpringBoot filtering: At least one property must be given
- ios - ios - send traffic over a connection (afnetworking or not) while waiting for response to keep it alive
- amazon-web-services - Assign Multiple EC2 instances to one Elastic IP
- c# - 剑道层次网格 - 层次结构不起作用
- spring - 从 Spring Boot 中的请求正文中删除垃圾字符?
- ajax - VueJS 将 Ajax 请求中的数据作为道具从父级传递给子级