dokuwiki-plugin-struct icon indicating copy to clipboard operation
dokuwiki-plugin-struct copied to clipboard

Allow rows with empty fields in aggregations

Open janlinde opened this issue 9 years ago • 5 comments

I didn't find a way to set up a struct / bureaucracy combination to show records with empty fields in aggregations. First-time use of both, so I might be completely missing something obvious. To now this was a show-stopper to my idea of a page allowing incremental data aquisition.

Consider a page showing an aggregation. It has an input field underneath, plus a submit button, just enough to create a new entry. After adding it, the new entry naturally should show up in the aggregation. The process shouldn't require the user to fill in all fields of the record, not even all fields currently displayed in the aggregation, and the stub record should show up in the list no matter what. Currently, bureaucracy allows me to add a record, and it displays a link to that page just after entering, but after a page refresh, the new entry disappears into oblivion, unless the list is stripped down to show only the column with the field just filled in.

For one, this way later additions to the aggregation's "col" field would miraculously make records disappear from the list, i.e. ununderstandably break / alter the installation's workflow. Secondly, my users foreseeably will find it convenient to just take note of a data item's existence, and then have other attributes added at a later point in time, either doing that themselves or allowing others to do it. struct's inline editing capabilities come in really handy here, btw.

The strata plugin allows columns to be tagged as optional{}, so I looked for something similar in struct. As I didn't find anything, I ended up disabling what I believe to be the crucial check in Search:: execute(), see the attached dokuwiki-struct-allow-empty-fields.patch for a proof of concept. This still didn't quite get me where I wanted, as pages apparently have to be present in the schema_assignments table to show up, which they are not always. I remedied that with dokuwiki-struct-assign-page-schema-to-new-pages.patch, also attached. The latter might amount to a bugfix or be completely misguided, not sure. With both patches applied, my use case works as intended.

20161009-allow-rows-with-empty-fields-in-aggregations.zip

janlinde avatar Oct 09 '16 14:10 janlinde

+1. Empty fields should not prohibit a page from being shown in the aggregated list.

danielfett avatar Nov 28 '16 11:11 danielfett

This behavior is actually as designed. But maybe an option keepEmpty would make sense?

For reference: This behavior has been implemented in #114 and flagged in #150

micgro42 avatar Nov 28 '16 11:11 micgro42

I would prefer a "hideEmpty" option, which would be more transparent for the user.

danielfett avatar Nov 28 '16 13:11 danielfett

I would prefer a "hideEmpty" option, which would be more transparent for the user.

So would I, the first patch implements just that.

OTOH, it does that globally, the more general way would be to allow that for individual aggregations, or, even more fine grained, for individual columns, as with strata's optional keyword.

janlinde avatar Nov 30 '16 10:11 janlinde

I would expect it on an per-aggregation level. The per-column "hideEmpty" can be emulated with filters.

danielfett avatar Nov 30 '16 10:11 danielfett