Skip to content

Commit

Permalink
Adding example file
Browse files Browse the repository at this point in the history
  • Loading branch information
THEBOSS0369 committed Oct 31, 2024
1 parent 7daba5e commit 00272c1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions doc/gui/examples/controls/collapse_data_view.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from taipy.gui import Gui
import json

# Sample JSON data for testing
json_data = {
"name": "Sample Data",
"type": "Example JSON",
"attributes": {
"id": 123,
"description": "A simple JSON structure for demonstration",
"values": [1, 2, 3, 4, 5],
"nested": {
"flag": True,
"count": 10
}
}
}

# Define the page with the JSON viewer
page = """
<|{json_data}|json|expandable|>
"""

if __name__ == "__main__":
Gui(page).run(title="DataNode JSON Viewer Example")
2 changes: 1 addition & 1 deletion frontend/taipy/src/DataNodeViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ const DataNodeViewer = (props: DataNodeViewerProps) => {
</>
) : dtType === "json" ? (
<>
<Suspense>
<Suspense fallback={<div>Loading JSON...</div>}>
<Grid container spacing={2}>
<Grid xs={12}>
<Typography variant="subtitle2">JSON Data</Typography>
Expand Down

0 comments on commit 00272c1

Please sign in to comment.