brunano21 / angular-4-data-table

An Angular 5 data table, with pagination, sorting, expandable rows, row selection, etc. with basic accessibility support.
MIT License
11 stars 19 forks source link

How to set default sorting column #51

Closed carlosmori94 closed 6 years ago

carlosmori94 commented 6 years ago

I want my grid to start with the arrow facing up so the user knows the grid is sorted by default. image

Thanks in advance!

brunano21 commented 6 years ago

Hi, you can use DataTable's[sortAsc]=true.

carlosmori94 commented 6 years ago

@brunano21 Thanks for the fast reply but that isn't working, when I populating the grid I need the first column to start with an intuitive arrow facing up, so the user understands is sorted by default. I got it like this image

I need it like this image

brunano21 commented 6 years ago

Hi, then you also need to set [sortBy]="'policyNumber'". This will sort the table by Policy #.

carlosmori94 commented 6 years ago

Thanks man, that worked perfectly!