Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default value from schema being ignored for: Arrays, Objects and DataFrames #17

Open
Tracked by #22
jgunstone opened this issue Jun 16, 2022 · 0 comments
Open
Tracked by #22

Comments

@jgunstone
Copy link
Collaborator

see this example:

if __name__ == "__main__":
AUTO_GRID_DEFAULT_VALUE = {
"description": "another description",
"dataframe": [
{"string": "important string", "integer": 1, "floater": 3.14,},
{"string": "update", "integer": 4, "floater": 3.12344,},
{"string": "evening", "integer": 5, "floater": 3.14},
{"string": "morning", "integer": 5, "floater": 3.14},
{"string": "number", "integer": 3, "floater": 3.14},
],
"alist": ["a", "b", "c"],
"anobject": DataFrameCols().dict(),
}
class DataFrameCols(BaseModel):
string: str = Field("string", aui_column_width=100)
integer: int = Field(1, aui_column_width=80)
floater: float = Field(3.1415, aui_column_width=70, aui_sig_fig=3)
something_else: float = Field(324, aui_column_width=100)
class TestDataFrame(BaseModel):
"""a description of TestDataFrame"""
description: str = "a description of my dataframe"
dataframe: typing.List[DataFrameCols] = Field(
default=AUTO_GRID_DEFAULT_VALUE, format="dataframe"
)
alist: typing.List[str] = ["a", "b", "c"]
anobject: DataFrameCols
# TODO: note that default values aren't being set from the schema for the Array or DataGrid
auto_grid = AutoUi(schema=TestDataFrame)
display(auto_grid)
if __name__ == "__main__":
auto_grid.value = AUTO_GRID_DEFAULT_VALUE

@jgunstone jgunstone mentioned this issue Oct 11, 2023
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant