naming
This commit is contained in:
@ -13,8 +13,8 @@ def aggrid(df, reload_data=False, height="auto", pagination=True):
|
|||||||
sortable=True
|
sortable=True
|
||||||
)
|
)
|
||||||
|
|
||||||
enable_auto_height = (height == "auto")
|
auto_height = (height == "auto")
|
||||||
gob.configure_auto_height(enable_auto_height)
|
gob.configure_auto_height(auto_height)
|
||||||
gob.configure_pagination(pagination)
|
gob.configure_pagination(pagination)
|
||||||
|
|
||||||
go = gob.build()
|
go = gob.build()
|
||||||
@ -26,7 +26,7 @@ def aggrid(df, reload_data=False, height="auto", pagination=True):
|
|||||||
theme="streamlit",
|
theme="streamlit",
|
||||||
fit_columns_on_grid_load=True,
|
fit_columns_on_grid_load=True,
|
||||||
reload_data=reload_data,
|
reload_data=reload_data,
|
||||||
key=make_key(df, enable_auto_height, pagination)
|
key=make_key(df, auto_height, pagination)
|
||||||
)
|
)
|
||||||
|
|
||||||
df = response.get("data", df)
|
df = response.get("data", df)
|
||||||
@ -36,14 +36,14 @@ def aggrid(df, reload_data=False, height="auto", pagination=True):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def make_key(df, enable_auto_height, pagination):
|
def make_key(df, auto_height, pagination):
|
||||||
"""
|
"""
|
||||||
encode the dataframe's column names into a key,
|
encode the dataframe's column names into a key,
|
||||||
as well as the state of the auto height and pagination settings,
|
as well as the state of the auto height and pagination settings,
|
||||||
this triggers a hard reload (like F5) of the AgGrid if the columns/settings change
|
this triggers a hard reload (like F5) of the AgGrid if the columns/settings change
|
||||||
"""
|
"""
|
||||||
items = list(df.columns)
|
items = list(df.columns)
|
||||||
items.append(enable_auto_height)
|
items.append(auto_height)
|
||||||
items.append(pagination)
|
items.append(pagination)
|
||||||
return "stand:" + "+".join(str(i) for i in items)
|
return "stand:" + "+".join(str(i) for i in items)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user