3

Instead of

pi-sort-alt, pi-sort-amount-up-alt, pi-sort-amount-down

would like to use

pi-sort, pi-sort-up, pi-sort-down

I think I can replace the content using css but wanted to check if there is a better way.

1
  • There seems to be a header slot in column (<Column><template #header>...</template></Column>) but it's not working properly for me. Might be an idea for a feature request... github.com/primefaces/primevue/issues Commented Sep 15, 2022 at 13:26

1 Answer 1

3

It's the slot "sorticon" and the parameter "sortOrder" can be used to identify which sorting state the column is in (0 for unsorted, 1 for sorted "up" and -1 for sorted "down")

Documentation: https://primevue.org/datatable/#api.column.slots.sorticon

Here's an example:

<Column field="sample" header="Sample" sortable>
    <template #sorticon="{ sortOrder }">
        <i v-if="sortOrder === 0" class="pi pi-sort-alt" />
        <i v-else-if="sortOrder === 1" class="pi pi-arrow-up" />
        <i v-else-if="sortOrder === -1" class="pi pi-arrow-down" />
    </template>
</Column>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.