首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如果列名中包含特殊字符和骆驼字符,则排序不适用于<>

如果列名中包含特殊字符和骆驼字符,则排序不适用于<>
EN

Stack Overflow用户
提问于 2018-01-03 12:27:26
回答 2查看 1.2K关注 0票数 0

我正在使用ngx-datatable.如果列名中包含特殊字符和骆驼字符,则排序无法工作。

例如, :

在表中,需要对下列列进行排序:

  1. displayName
  2. first_name

有人能给我提供解决方案吗?

感谢并致以问候

希尔帕·库尔卡尼

EN

回答 2

Stack Overflow用户

发布于 2018-01-03 12:40:31

对不起,我还没有发表评论,我只是介绍了我的经验,我已经与这个网格工作过,这是很棒的,但我迁移到primeNG是最好的解决方案,更灵活的工作。

票数 0
EN

Stack Overflow用户

发布于 2018-05-23 10:56:45

代码语言:javascript
复制
<ngx-datatable-column *ngFor="let col of columns" name="{{col.name}}" prop="{{col.prop}}" class='{{col.prop}}' [sortable]="false" [cellClass]="getCellClass">
<ng-template let-column="column" let-sort="sortFn" ngx-datatable-header-template>
                        <span class="datatable-header-cell draggable unselectable" (click)="onSort($event,col.prop, col.sortAscending = !col.sortAscending)" title="{{col.desc}}">
                            {{col.name}}
                        </span>                       
                    </ng-template>
</ngx-datatable-column>

public columns: Array<any> = [
        { name: 'Display Name', prop: 'displayName', sortAscending: false }, 
        { name: 'First Name', prop: 'first_name', sortAscending: false }, 
        ];

private onSort(event: any, column: string, sortingType: boolean) {
//here update the resilt rows as per assending or desc
}
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48077408

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档