Skip to content

Commit

Permalink
Merge pull request #176 from communitiesuk/scrollable-table
Browse files Browse the repository at this point in the history
Scrollable table
  • Loading branch information
kateriley1 authored Sep 12, 2024
2 parents dc6713e + 8ced8b6 commit 69ec5f9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
27 changes: 14 additions & 13 deletions gov_uk_dashboards/components/plotly/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import Optional
from pandas import DataFrame
from dash import html, dcc
from gov_uk_dashboards.components.plotly.row_component import row_component
from gov_uk_dashboards.components.plotly.card import card


Expand Down Expand Up @@ -195,6 +194,12 @@ def table_from_polars_dataframe(
className="govuk-table__row",
),
className="govuk-table__head-short" if short_table else "govuk-table__head",
style={
"position": "sticky",
"top": 0,
"z-index": 1,
"background-color": "#fff",
},
)
)

Expand Down Expand Up @@ -222,17 +227,13 @@ def table_from_polars_dataframe(
)
)

return row_component(
card(
html.Table(
table_contents,
className="govuk-table table-header-cell-top-padding",
id=table_id,
role="table",
**table_properties,
),
amend_style={"padding": "0px"},
return card(
html.Table(
table_contents,
className="govuk-table table-header-cell-top-padding",
id=table_id,
role="table",
**table_properties,
),
horizontal_scroll=True,
amend_style={"padding": "0px", "margin-top": "0px"},
amend_style={"padding": "0px"},
)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
author="Department for Levelling Up, Housing and Communities",
description="Provides access to functionality common to creating a data dashboard.",
name="gov_uk_dashboards",
version="11.3.0",
version="11.4.0",
long_description=long_description,
long_description_content_type="text/markdown",
packages=find_packages(),
Expand Down

0 comments on commit 69ec5f9

Please sign in to comment.