Data-table column reordering
Hey @dhis2/team-apps , I’ve got one of those questions. It is regarding the data-table component I am currently working on.
Use case: a useful feature for data-tables is editing/reordering of columns. This will be achieved by clicking a button in the table header to open a modal. This modal has a table with table rows for each available attribute. Each attribute can be toggled on/off and drag and drop reordered.
My question: how do we/can we include this functionality in the data-table component(organism)? This will be used often, across multiple apps, so of course we don’t want people to be rewriting code. However, I’m not sure it makes sense to be including this kind of functionality inside the data-table component itself? Is it an optional ‘include’? Perhaps it makes sense as a private component table-row-editor or something? I am currently writing the design documentation for the data-table and it makes sense for me to include this as an available feature there.
I wanted to open the discussion here and get some feedback in case it had any effect on the docs I am currently writing. Please do add any feedback! Thanks.
Visual example of column reordering:

I think it makes sense to have this as a separate component.
- It can be used to sort all kinds of things This could be done either through checkboxes (for tables) or radio buttons (for multiselects)
- I assume that the sorting algorithm will differ from table to table We should not enforce a certain sorting strategy here other than telling the implementing app which rows to sort and in which order
For the data table: I don't know how this will work in terms of fetching data from the backend. If there's only one way to fetch the data and one pattern these will be returned, we could use the sorting modal in the data-table.
If the data table will be given a list of data elements by the app, this has to be implemented separately (it's up to the app then how to calculate and cache the derived column order)
Hey @Birkbjo, since you implemented custom columns in Maintenance, maybe you have some insight to share here?
Hi! Due to a lack of activity on this issue over time (7.776*10^9 ms and counting, to be precise) it seems to be stale. If there is no further progress on it, it will be closed automatically.
If this is still relevant, maybe there is something you can do to move it forward? For example provide further information in a comment, or supply a PR? Any activity on this issue will keep it open. Thanks! 🤖
Relevant.