I am trying to make ag-grid occupy the full page (100% of visible space in browser). Below is css I use for that, but it is not doing what I expected. The result datatable seems to occupy 200% of page width and 50% of height. What should I do to make the table be 100%x100% of the page and not have the default browser scrollbars?
Dash version 2.13.0, Windows operating system.
CSS:
html,
body {
margin: 0;
padding: 0;
overflow: auto;
}
/* use viewport-relative units to cover page fully */
html, body {
height: 100vh;
width: 100vw;
}
/* include border and padding in element width and height */
* {
box-sizing: border-box;
}
/* full-sized container that fills up the page */
div {
height: 100%;
width: 100%;
}
Python code sample:
from dash import Dash, html
import dash_ag_grid as dag
import pandas as pd
# Make pandas dataframe
def make_main_df():
return pd.DataFrame({"issue": [1, 2, 3], "assignee": ["Sam", "John", "Kim"]})
# Make ag-grid from pandas dataframe
def make_table_grid(df):
grid = dag.AgGrid(
id="main-df",
rowData=df.to_dict("records"),
columnDefs=[{"field": i} for i in df.columns],
className="ag-theme-alpine-dark",
columnSize="sizeToFit",
)
return grid
# App layout
def serve_layout():
main_df = make_main_df()
layout = html.Div(
[
make_table_grid(main_df),
],
className="main-div",
contentEditable="false",
)
return layout
app = Dash(__name__, title="Issues in progress", include_assets_files="toy.css")
app.layout = serve_layout
# Run the app
if __name__ == "__main__":
app.run_server(debug=True, port=3010)
Result