Vue3-datatables
  • Dependencies & Compatability
  • Getting Started
  • Client Table
    • Asynchronous Loading
    • Grouping
    • Filtering Algorithm
    • Editable Cells
  • Server Table
    • Implementations
    • Custom Request Function
    • Setting Multiple Request Parameters
    • Error Message
    • Draw Counter
  • Dependencies & Compatability
  • Getting Started
  • Virtual Pagination
  • Column Templates
  • Nested Data Structures
  • Selectable Rows
  • List Filters
  • Custom Template
  • Custom Filters
  • Multiple Sorting
  • Date Columns
  • Custom Sorting
  • Conditional Cell Styling
  • Columns Visibility
  • Child Rows
  • Properties
  • Slots
  • Methods
  • Events
Powered by GitBook
On this page

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.

PreviousDate ColumnsNextConditional Cell Styling