verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
95 stars 70 forks source link

Table column width has no effect #1531

Open jmauzyk opened 1 year ago

jmauzyk commented 1 year ago

Describe the bug

Changing the width configuration for a column of a table field appears to have little to no effect. Here is an example with no width setting:

Screenshot 2023-08-10 at 8 42 37 AM

Here is the table field with the column widths set to 50 and 5:

Screenshot 2023-08-10 at 8 44 37 AM

The columns no longer split the container width evenly, but the column widths don't seem to correspond to the width settings.

Steps to reproduce

  1. In a table field, set the width for columns and save.
  2. View field in rendered form.

Form settings

Craft CMS version

4.4.16.1

Plugin version

2.0.33

Multi-site?

Yes

Additional context

No response

engram-design commented 1 year ago

By default, the width of table cells will be split evenly over the parent container. Are you sure there's no conflicting CSS on your site that would make the table cells not stretch the full width (50/50 in your example)?

As for the width value, that's unit-less so you can have control over things. You'll want to probably use 50px or 50% to produce <th width="50px" data-handle="column1" data-type="singleline">Column 1</th> You'll also likely want to add .fui-table { table-layout: fixed; } to make that work.

jmauzyk commented 1 year ago

I see, I didn't realize units were required and for some reason my brain assumed it corresponded to the input size attribute. Might be worth putting a mention of this in the documentation.

Is it possible to style the inputs within the table? I tried adding the following to our theme config, but it didn't have any effect on the inputs.

        'table' => [
            'fieldAddButton' => [
                'attributes' => [
                    'class' => 'info-button'
                ]
            ],
            'fieldInput' => [
                'attributes' => [
                    'class' => 'pure-input-1'
                ]
            ]
        ],
engram-design commented 1 year ago

Nah, it won't be the input size attribute, because a table cell can have other things, other than a text input for example.

As for styling fields within Table cells, you're right that's not quite supported yet as I haven't figured out a good way to model that.