Skip to content
Discussion options

You must be logged in to vote

Below Code is working fine.

Custom Sorting Code:

const sortItems = (prev: Row, curr: Row, columnId: string) => {
if (prev.original[columnId].toLowerCase() > curr.original[columnId].toLowerCase()) {
return 1;
} else if (prev.original[columnId].toLowerCase() < curr.original[columnId].toLowerCase()) {
return -1;
} else {
return 0;
}
};

Column:

{
Header: 'Sample Header',
accessor: 'sampleHeader',
sortType: (prev, curr, columnId) => {
return sortItems(prev, curr, columnId);
}
}

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by Kavimugilan17
Comment options

You must be logged in to vote
1 reply
@as-zlynn-philipps
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants