DataviewJS TaskList without Header

What I’m trying to do

For project notes I want to list all tasks with the status !.

let page = dv.current().file.tasks
dv.taskList(
    page
    .where(t => t.status === "!")
)

But this will give me the note name as a heading. I want it without the note name.

Things I have tried

I tried to use groupByFile = false as by the reference

let page = dv.current().file.tasks
dv.taskList(
    page
    .where(t => t.status === "!"),
    groupByFile = false
)

But that results in an error
“Evaluation Error: ReferenceError: groupByFile is not defined”

I did find a solution (workarround), for showing another header, in dql. But I’m not sure how to dynamically select just the current note and I have not tried to grab the task status.

In DvJS tasks are grouped by default. You can use something like:

let page = dv.pages().file.tasks;
dv.taskList(
    page
    .where(t => t.status === "!").groupBy(p => p="Tasks")
)

But if you don’t want any header, then use DQL query:

TASK
WHERE status = "!"
1 Like

Thanks for the quick response.
I was actually thinking of filtering the “tasks” and group them by status. I guess that would have done the trick :rofl:

Would you have any insides about the groupByFile option? I would love to update the reference. If not I’ll follow up on this on GitHub.

For the DQL solution:
How can I only narrow the scope to the current note? This should be dynamic solution. I know I could use templates at the creation. But if I change the file name/path, the query should still work.
That was actually the main reason I opted for DvJS.

  1. About the groupByFile I never tried (I’m more a dql user… and I’m not coder or similar). But I think you can use this format:
let page = dv.pages().file.tasks;
dv.taskList(
    page
    .where(t => t.status === "!"), false
)
  1. About DQL solution and defining only the current note, you can use this:
TASK
WHERE file.path = this.file.path
WHERE status = "!"
2 Likes

That was a fairly dumb mistake of mine.

Thx. I’ll update the documentation.

1 Like

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