Is there a way to add additional task field to render on dv.taskList call

Things I have tried

What I’m trying to do


Hi everyone. I need help achieving this view:

изображение

I’ve made the function that counts some task score. After all I have an array of tasks with additional property taskScore

изображение

I could even sort by this field and render taskList in desired order. And it works.

The difficulty starts when I try to output all the tasks with the scores (or any other field like project name) shown in taskList.

The only workaround that I’ve found is to add to task.text field every piece of information that I want, but than checkbox stops to work because of inner logic of dv.taskList uses task.text field as an unique pointer to the specific task as I can understand from sources. (first parameter in setTaskCompletition call)

So my question: is there any convenient way of output any additional information next by the task name and not to break the logic and not touching source code cause I have zero knowledge in TypeScript and also want to keep ability to update the plugin.

Thanks for any ideas in advance

Hi. I’m an Obsidian regular user without any academic knowledge in code or similar. With the experience (a long learning curve) I learn some things about dataview, mainly in DQL.
Now I can read and work with basic dvjs, but pure JS remains a strange field.

All this to say: because your code is mostly javascript (not the basic dvjs) I don’t understand most of it. But I understand your main issue (I think…): if you change the tasks content you lose the interaction with the real task.

With some help of Sam (mainly in regex part), I created this query example to list and add colors to tasks with a priority field.

https://s-blu.github.io/obsidian_dataview_example_vault/20%20Dataview%20Queries/Colorcode%20tasks%20based%20on%20meta%20data/

To do that I used the dv visual function that allows us to render arbitrary text for tasks (separating the render content from raw content). Maybe this is the “door” you need to explore to achieve what you want.

1 Like

Thanks a lot. From first sight task.visual - is exactly what I’ve been looking for. I wonder why didn’t I find this property anywhere in documentation. I guess most of users does not know of a way to add some colors and other stuff to task list. It works not only with colors but with every other piece of information or decoration one might want to use to represent a tasks in a list.

1 Like

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