Jul 29, 2022 02:17 PM
Hello, the airtable documentation shows that to sort a query using selectRecordsAsync you should do it as follows:
let queryResult = await table.selectRecordsAsync({
sorts: [
// sort by "Description" in ascending order
{field: "Description"},
// then by "Priority" in descending order.
{field: "Priority", direction: "desc"},
]
});
but this is apparently deprecated. How can I do it with the current codebase?
Jul 29, 2022 02:33 PM
Can you please say why you think this is deprecated?
Jul 29, 2022 02:44 PM
I think I solved my problem. Correct me if I’m wrong, but before, when I used
let query = await table.selectRecordsAsync({sorts: [{field: "some column"}]})
I had a message where it told me that behavior was deprecated, but I think it was referring to the fact that I hadn’t specified any fields.
If the documentation had shown an example using both the fields and sorts argument together I think I would have spared myself the confusion.