简体   繁体   中英

ag-grid keep sort icons visible

I'd like to keep the sort icons visible in table header columns all the time. But the default behavior of ag-grid is hiding the icons ( .ag-header-cell-sorted-asc, .ag-header-cell-sorted-desc ) as soon as I click on any header label.

Is there any option to change this behavior?

This is how I define the header columns:

@Component({
  selector: 'test-list',
  templateUrl: './test-list.component.html'
})
export class TestListComponent {
    public columnDefs = [
        { headerName: 'Test', field: 'test', minWidth: 150, sort: 'asc' },
        { headerName: 'Test1', field: 'test1', minWidth: 150, sort: 'desc'},
        { headerName: 'Test2', field: 'test2', minWidth: 250 }
      ];
}

Are you talking about the unSortIcon?

{
        headerName: "Year",
        field: "year",
        width: 90,
        unSortIcon: true
},

Have a look at the below plunker example from ag-grid

https://plnkr.co/edit/FylOQ5cAD9id4LbgI3NN?p=preview

See the difference in column 'Year' and all other sort enabled columns? For Year column there is unSortIcon: true is applied.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM