Skip to content

Commit

Permalink
Merge pull request #186 from communitiesuk/scrolly-table
Browse files Browse the repository at this point in the history
Scrolly table - fixed headers
  • Loading branch information
kateriley1 authored Dec 20, 2024
2 parents d1367e7 + 95cd53c commit d063283
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 22 deletions.
58 changes: 37 additions & 21 deletions gov_uk_dashboards/components/plotly/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
from dash import html, dcc
from gov_uk_dashboards.components.plotly.card import card
from gov_uk_dashboards.components.plotly.paragraph import paragraph
from gov_uk_dashboards.components.plotly.row_component import row_component

# from gov_uk_dashboards.components.plotly.row_component import row_component


def table_from_dataframe(
Expand Down Expand Up @@ -260,24 +261,39 @@ def table_from_polars_dataframe(
)
)

return row_component(
card(
row_component(
card(
[
html.Table(
table_contents,
className="govuk-table table-header-cell-top-padding",
id=table_id,
role="table",
**table_properties,
),
paragraph(table_footer) if table_footer else None,
],
amend_style={"padding": "0px"},
),
horizontal_scroll=True,
)
),
horizontal_scroll=True,
# commented below out as prevents sticky header, although now not optimised for mobile devices
return card(
[
html.Table(
table_contents,
className="govuk-table table-header-cell-top-padding",
id=table_id,
role="table",
**table_properties,
),
paragraph(table_footer) if table_footer else None,
],
amend_style={"padding": "0px"},
)

# return row_component(
# card(
# row_component(
# card(
# [
# html.Table(
# table_contents,
# className="govuk-table table-header-cell-top-padding",
# id=table_id,
# role="table",
# **table_properties,
# ),
# paragraph(table_footer) if table_footer else None,
# ],
# amend_style={"padding": "0px"},
# ),
# horizontal_scroll=True,
# )
# ),
# horizontal_scroll=True,
# )
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="12.3.4",
version="13.0.0",
long_description=long_description,
long_description_content_type="text/markdown",
packages=find_packages(),
Expand Down

0 comments on commit d063283

Please sign in to comment.