Skip to content

Conversation

nordmograph
Copy link

Pull Request for Issue # .

Summary of Changes

The width was hardcoded to 45%, regardless of the number of columns. This change makes it dynamic, distributing the width according to the number of fields, while reserving 8% for the action column.

Testing Instructions

Create a subform 'test' field with a repeatable.table layout and at least 3 (text for eg.) fields in it.
(layout="joomla.form.field.subform.repeatable-table") + subform_test.xml

Actual result BEFORE applying this Pull Request

2 first fields have 45% as width and the 3rd and following ones are compressed

Expected result AFTER applying this Pull Request

the width of ech field is a divisiion of the total width per the amount of fields

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

The <th> width was hardcoded to 45%, regardless of the number of columns.
This change makes it dynamic, distributing the width according to the number of fields, while reserving 8% for the action column.
@richard67 richard67 changed the title Update repeatable-table.php [5.4] Update repeatable-table.php Oct 15, 2025
@HLeithner HLeithner added the bug label Oct 15, 2025
@chmst
Copy link
Contributor

chmst commented Oct 17, 2025

Tested and works perfectly.
I’d round it to two decimal places - this looks a bit weird:
grafik

$fields = $tmpl->getGroup('');

foreach ($fields as $field) {
$table_head .= '<th scope="col" style="width:' . (92 / count($fields)) . '%">' . strip_tags($field->label);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please calculate width once before "foreach" call,
no need to do it for every field, result will be the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants