# Custom Sorting

Sometimes you may wish to override the default sorting logic which is applied uniformly to all columns.

To do so use the `customSorting` option. This is an object that recieves custom logic for specific columns.

E.g, to sort the `name` column by the last character:

name: function (ascending) {

var lastA = a.name\[a.name.length - 1].toLowerCase();

var lastB = b.name\[b.name.length - 1].toLowerCase();

return lastA >= lastB ? 1 : -1;

return lastA <= lastB ? 1 : -1;

This depends entirely on your backend implemetation as the library sends the sorting directions through the request.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ryunosukee.gitbook.io/vue3-datatables/custom-sorting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
