UI: Add Column Type List
Hi all
To implement Move Role-Permissions-Table to DataTable. It would be very helpful to have a column-type "Listing". This PR adds it.
...but there is more: There was also the wish to have the columns be truncated. I added some function to the interface to make this possible, although I must admit that I've a hard time to find the right structure and nomenclature. I did not implement much of it as I would kindly ask you for your opinion before investing the time to programming the whole thing:
- I think it is a good idea for it to be enabled with one single and clear function call even though we actually need to have two things happening: The truncation needs to be enabled and we need to have a text to be presented, when the cell is truncated. We could also provide a default text, but I would have no clue what it should be and I don't think there even is a viable option. I thus added a single mutator
withTruncation(\Closure $truncated_text_closure), but two gettersisTruncationEnabled(): boolandgetTruncatedTextClosure(): ?\Closure. As said: nomenclature is tentative. AllColumn-types up to this points get all their properties through the constructor. I don't think this is the right solution in this case. - When it comes to the implementation, right now I thinking along the lines of internally expanding
Listing\OrderedandListing\Unorderedwith a functionwithTruncation(string $truncated_text)without exposing it on the interface. TheClosurepassed toTable\Column\Listing::withTruncation()would then be called in theTable\Column\Listing::format()and would receive the value as parameter. More complex context could be accessed by leveraging the fact that the value comes from aGenerator. I don't think this is going to be beautiful, but right now it is the best I could think of, without breaking the separation of concerns.
I'm very grateful for any feedback!
Thank you very much and best, @kergomard
Hi @kergomard
Thank you a lot for contributing to ILIAS. You will get some further feedback, nevertheless, I would like to point out that the HTML validator spits out a few errors if you want to take this into account already (Line 5506-5621):
- [ ] The role attribute must not be used on a tr element which has a table ancestor with no role attribute, or with a role attribute whose value is table, grid, or treegrid.
- [ ] The role attribute must not be used on a th element which has a table ancestor with no role attribute, or with a role attribute whose value is table, grid, or treegrid.
- [ ] The role attribute must not be used on a td element which has a table ancestor with no role attribute, or with a role attribute whose value is table, grid, or treegrid,
- [ ] Attribute aria-colindex not allowed on element th at this point.
- [ ] Bad value Ascending for attribute aria-sort on element th.
- [ ] Bad value 0 for attribute aria-colindex on element td: Zero is not a positive integer.
If I can support you with finding these errors, please contact me.
kindly @yvseiler
Thank you very much for the feedback @yvseiler ! I will check this once we are clear on the interface, I'm not really sure this issue really is related to my changes, but I will figure it out, when I get there.
Thanks again and best, @kergomard
Hi everyone,
@kergomard and I quickly discussed this today. We agreed that we want to try to treat the "truncation"-issue as a strictly visual problem, i.e. not exposing any functionality for truncation to PHP developers for the moment.
General idea is that for a List Column the table would e.g. show the first three entries of the list and then a button saying "show all 10 entries" to expand the row to show the rest.
I'm sure @kergomard will want to elaborate at some point, this is just a quick marker to keep everyone updated on the progress here.
Kind regards!
@kergomard Please pass back to me and ping me for the next iteration. Thanks!
Thank you very much @klees for the talk and feedback!
I now implemented a approach that is fully based on convention:
- Lists in Tables are currently always reduced to 2 items + a "Show 4 more items"-shy-button.
- This is true for the column types 'List' and 'LinkList'.
- The changes are actually mostly in
ILIAS\UI\Implementation\Listing. I have not surfaced them to the interface though, but I think it could be an option to do so. I would then stick to the "convention over configuration"-approach and not make the amount of items configurable. - The implementation is kept minimal on purpose, there e.g. is no styling. I right now believe this to be the right approach here, but clearly we could do a lot of moving around.
- The implementation looks like this: Bildschirmaufzeichnung vom 2025-08-11 10-02-38.webm
Thanks again and best, @kergomard