Task List Order

I have listed the tasks listed in “Project Files” in dataviewjs below.

dataviewjs
dv.taskList(dv.pages('"Project Files"').file.tasks
.where(t => !t.completed)
.groupBy(t => t.section))

In this state, they are listed in order of filename, but is there a way to list them in the order in which the files were modified?

I’m not versed in JS and this is a “hard” task to solve (in DQL it’s a easy thing, because the group retains in rows all metadata in page object… but in JS it retains in rows only the metadata in tasks level).

But try this:

dv.taskList(dv.pages('"Project Files"').file.tasks
.where(t => !t.completed)
.groupBy(t => t.section)
.sort(k => dv.page(k.key.path).file.mtime, 'desc'))

DQL query

TASK
FROM "Project Files"
WHERE !completed
GROUP BY section
SORT rows.file.mtime DESC
3 Likes

hi, @mnvwvnm
That’s perfect!!! Thank you so much!!!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.