Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

table sorting ant design

const columns = [{
  title: 'Name',
  dataIndex: 'name',
  sorter: (a, b, sortOrder) => {
    if (a.name != null && b.name != null) {
      a.name.localeCompare(b.name);
    }
    if (a.name) {
      return sortOrder === 'ascend' ? 1 : -1;
    }
    if (b.name) {
      return sortOrder === 'ascend' ? -1 : 1;
    }
    return 0;
  },
}]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #table #sorting #ant #design
ADD COMMENT
Topic
Name
8+3 =