43

I want to filter the column in alphabetical order here is the code to filter by the size how to do thank you

const columns = [{
      title: 'First Name',
      dataIndex: 'first_name',
      sortDirections: ['descend', 'ascend'],
      key: 'first_name',
      width: '20%',
      sorter: (a, b) => a.first_name.length - b.first_name.length,

    }]
OAH
  • 1,160
  • 2
  • 11
  • 24

1 Answers1

98

You can use localeCompare()

sorter: (a, b) => a.first_name.localeCompare(b.first_name);
Maheer Ali
  • 35,834
  • 5
  • 42
  • 73