Skip to content

rx.data_table shows blank cells for some column keys (possibly case-related?) #6108

@phchau6

Description

@phchau6

rx.data_table shows blank cells for some column keys (possibly case-related?)

What I’m seeing

I might be missing something obvious, but I’m running into a weird behavior with rx.data_table: after loading data, the table headers render, but only one column (“from”) shows values. The other two (“Route” and “To”) stay blank even though the underlying data seems present.

Minimal repro

import reflex as rx
import pandas as pd


class State(rx.State):
    data: list = []

    def load_data(self):
        df = pd.DataFrame(
            {
                "Route": ["1", "2", "3"],
                "To": ["Central", "Kowloon", "Airport"],
                "from": ["Tsuen Wan", "Mong Kok", "Tung Chung"],
            }
        )
        self.data = df.to_dict("records")


def index():
    return rx.vstack(
        rx.button("Load Data", on_click=State.load_data),
        rx.data_table(
            data=State.data,
            columns=["Route", "To", "from"],
            sort=True,
        ),
    )


app = rx.App()
app.add_page(index)

Steps to reproduce

  1. Run the app.
  2. Click Load Data.
  3. Observe the table.

Expected

All three columns should display values.

Actual

  • Column from displays correctly (Tsuen Wan, Mong Kok, Tung Chung)
  • Columns Route and To appear but their cells are empty.

Screenshot

(Attached) — only the from column shows values.

Image

Guess / question

Not sure if this is intended, but I wonder if the table is normalizing column keys internally (e.g., lowercasing "Route" / "To"), which might cause it not to match the dict keys coming from df.to_dict("records"). Totally possible I’m using columns wrong though.

Workaround I found

If I rename the DataFrame columns to lowercase (e.g., route, to, from) it seems to work.

Environment

  • Reflex: 0.8.26
  • Python: 3.12
  • OS: Mac
  • Browser: Google Chrome

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions