Show TODO toggle in query table view

When querying TODOs all looks fine in block view, but when turning on Table view, then the TODO toggles disappear from the block’s contents.

It would be nice to be able to see all todos in table view and be able to click on the toggles to complete tasks.

See comparison below:

Block view

Table view

You can achieve this by using an advanced query.


#+BEGIN_QUERY
  {:title "Your Search"
  :query [:find (pull ?b [*])
  :where
  [?b :block/marker ?marker]
  [(contains? #{"WAITING" "TODO"} ?marker)]
                [?b :block/priority ?priority]
        [(contains? #{"A" "B" "C"} ?priority)]
]
       :result-transform (fn [result]
       (->> result
       (map (fn [r] (assoc r :block/properties {:marker (get r :block/marker)} )))
        )
)
 :collapsed? false
:breadcrumb-show? true
}
#+END_QUERY

If you only want to show priority “A”, just delete the unwanted priorities in the line " [(contains? #{“A” “B” “C”} ?priority)] " (e.g. [(contains? #{“A”} ?priority)] )

By clicking on “set properties” and deactivating and activating the properties in your desirerd order, you can set the order of your columns!

This is useful. If I wanted to disable showing parent blocks in results would this require an advanced search as well?

Thanks very much for your reply! This seems to be a step in the right direction. I see the marker, however it is still not possible to click on the toggle to complete the task from the table view.

If clicking on the toggle to complete the tasks from the table view were possible, then we would get a UX similar to traditional task managers, which would be nice.

@ste I played around a bit with your query to try implementing another thing I would like to have which is to show the journal day in table view. So under :result-transform I replaced (get r :block/marker) with (get-in r [:block/page :block/journal-day]) and I got the following:

Any idea how to get the date to be displayed as shown in the journal title (e.g Nov 24th, 2022 instead of 20221124)?

Edit: Using :block/name instead of :block/journal-day does display the date, however if you click on the column to sort by that column, it will sorty alphabetically instead of by actual date. However if you create a date property on the block itself and add a journal page as a value, the column both shows the date and also sorts correctly chronologically when clicking on it. Is there a way to have that same behaviour with a :result-transform without adding the date itself manually to each block as a property?

I can’t help you with that @danilofaria . I am also not too firm with the commands.

Not sure I understand your question