I developed a simple code in Python Flet that consists of a DataTable added to a Row, inserted into a Column. These nested controls are added into a container with dimensions that don't allow to display all the table content. With the current settings (ft.Scroll.ALWAYS for the Column, and ft.Scroll.ADAPTIVE for the Row), the vertical scroll bar is shown but the horizontal scrollbar appears only when the table is moved down at its bottom. I would like to have both vertical and horizontal scrollbars always visible on the table. I tried to change the values of both scroll types but nothing changed.
import flet as ft
def main(page: ft.Page):
column_items = [ft.DataColumn(ft.Text(f"Column {i+1}")) for i in range(36)]
cell_items = [ft.DataCell(ft.Text(f"Cell {i+1}")) for i in range(len(column_items))]
row_items = [ft.DataRow(cells=cell_items) for _ in range(50)]
data_table = ft.DataTable(columns=column_items, rows=row_items)
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
page.vertical_alignment = ft.MainAxisAlignment.CENTER
page.add(
ft.Container(
height=500,
width=700,
content=ft.Column(
scroll=ft.ScrollMode.ALWAYS,
controls=[
ft.Row(
scroll=ft.ScrollMode.ADAPTIVE,
controls=[data_table],
)
],
),
)
)
ft.app(target=main)