Skip to content

the doc on the styles argument of render.DataGrid() is incorrect: snake-case works #1591

@shrektan

Description

@shrektan

It says:

style: A dictionary of CSS properties and values to apply to the selected rows and columns. The keys must be camelCased CSS property names to work properly with react.js (e.g. backgroundColor instead of background-color).

image

However, the following code works.

...
styles = [
  {
      "style": {"text-align": "center"},
  },
  {
      "cols": num_cols_idx,
      "style": {"text-align": "right"},
  },
  {
      "rows": list(range(1, df.height, 2)),
      "style": {"background-color": "#f9f9f9"},
  },
]
return render.DataGrid(df, filters=True, styles=styles)  # type: ignore
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions