TableColumn width property

How can we manually adjust each TableColumn’s width in version after 2.2.0?

In prior versions, the column in the data table would take the width as given in the TableColumn property:

    columns = [
            TableColumn(field='region',                    title='Region',             width=200),
            TableColumn(field='country_name',              title='Country',            width=100)
            ]

table = DataTable(source=source, columns=columns, editable=True, width=1900,
                  height=725, index_position=None)

In version after 2.2.0, this seems to be ignored. I have tried the different autosize_mode, but none of the four modes helped.

How can I specify individual widths in the new layout?

Testing with 2.2.0, it looks to me like autosize_mode='none' gives the result that I expect from your inputs here. The ‘region’ column is 200 wide, and ‘country’ is 100, but of course that leaves 1600 unused but allocated width in the table, so that last column stretches the remaining width.

Is this what you expect to see? If not, can you describe the behavior you’re looking for?

The problem was that in my fully application I had more field widths than the 1900 and it did automatically reduce it to 1900, which is no longer the case after version 2.2.0. But I did adjust my columns to fit in the 1900. Then it works. You did point me in the right direction. Thank you for your help, Carolyn.

2 Likes