Search code examples
angulartypescriptsortingng-zorro-antd

How to enable specific sorting on ng zorro table?


i have a Ng Zorro table with Angular and i have setup server sorting. Is there a way to disable null sorting on the table UI?

I wuold like to only sort the table 'descending' and 'ascending'. Specifically i would like the table UI to only allow sorting two times like in the image below:

Table sorting ascending:

table sorting ascending

Table sorting descending

table sorting descending

But this:

table sorting null Will return 'null' in the backend server and i want to remove that functionality from ng zorro

Is it possible to do it in ngZorro table?


Solution

  • According to the documentation you can setup the properties:

    [nzSortOrder]   
         Sort direction 'ascend' | 'descend' | null  
    [nzSortDirections] 
         Supported sort order, could be 'ascend', 'descend', null   Array<'ascend' | 'descend' | null>  
         Default ['ascend', 'descend', null]
    

    https://ng.ant.design/components/table/en (Sort property)