I have implement an Ant Design Table in a Gatsby site. I am pulling in the data from graphql. So far everything has worked just fine. The data is displaying properly, pagination works, etc.
Now I want to add the ability to sort the columns. To do so, I set up the table and columns as follows:
<Table
dataSource={data.allNewsFeed.edges}
onChange={onChange}
rowSelection={rowSelection}
rowKey="id"
>
<Column
title="Title"
dataIndex="node.title"
key="title"
sorter={(a, b) => a.node.title - b.node.title}
sortDirections={["descend", "ascend"]}
/>
</Table>
Now, the icon for sorting the column does shows up, but nothing happens when I click on it.
Same thing happens if I remove .node
from the sorter function: sorter={(a, b) => a.title - b.title}
.
So, I am stuck -- any idea why this is not working and how to fix it?
Thanks.