Skip to content

Datatables do not respect the flex column_arg #570

@amks1

Description

@amks1

As per the documentation here and here, the flex key should be able to resize the columns to fit the page width in proportion to the flex values given.

Here's my code:

def test_pywebio():
	row = {
		"Col1": "1",
		"Col2": "asddddddda",
		"Col3": "asdasd",
		"Col4": "asdasdasd",
		"Col5": "asd",
		"Col6": "asd",
		"Col7": "asd",
		"Col8": "asdasdasdas",
		"Col9": "asdasda",
	}
	col_args = {
		"Col1": {"flex": 1},
		"Col2": {"flex": 6},
		"Col3": {"flex": 2},
		"Col4": {"flex": 2},
		"Col5": {"flex": 2},
		"Col6": {"flex": 2},
		"Col7": {"flex": 2},
		"Col8": {"flex": 6},
		"Col9": {"flex": 2},
	}

	pywebio.output.put_datatable([row], column_args=col_args, height='auto')

Here's the output:

image

As you can see, the flex values are not being considered.
I also tried using maxWidth, minWidth and width values, and although there are some changes to the table sizes, it does not work as documented.

Environment Information

  • OS and Version: Win11
  • Browser and Version: Chrome Version 111.0.5563.147 (Official Build) (64-bit)
  • Python Version: v3.11.2
  • PyWebIO Version: 1.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions