Pages not dynamic enough (?) #1258
-
I am trying to figure out if Taipy is suitable for my use case and could use insight from somebody more experienced in this framework. I can map some of the functionality to Taipy quite nicely, but I am still struggling with the following part (greatly simplified): The home page has table of items. Clicking on a row ( {
"id": "TEST-1",
"name": "Test 1",
"targets": [
{
"category": "target_category_1",
"name": "Web 1",
"dst_ips": [],
"src_ips": [],
}
],
"dates": [
{
"type": "date_category_1",
"date": "01-Jan-2024"
},
{
"type": "date_category_2",
"date": {
"start": "01-Jan-2024",
"end": "10-Jan-2024"
}
},
],
"people": [
{
"type": "person_category_1",
"name": "Test Person",
"email": "[email protected]",
}
],
}, It should provide the possibility to change all the values, in case of lists also add or remove whole sections (e.g. in targets). I tried several approaches and so far failed in all of them. The problem I am facing is that the pages in Taipy seem to be quite static - e.g. I don't know upfront how many targets there will be and also this dynamically changes with the user's interaction. Any help or suggestions are greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Would partials help you? It is a way to change a part of your page in real-time. Here is an unrelated code to explain how partials can be used: from taipy.gui import Gui
import taipy.gui.builder as tgb
value = 15
min_slider = 10
max_slider = 200
def create_slider_partial(min_slider=10, max_slider=200):
with tgb.Page() as new_slider:
tgb.slider("{value}", min=min_slider, max=max_slider)
return new_slider
def change_partial(state):
state.slider_partial.update_content(state, create_slider_partial(state.min_slider, state.max_slider))
with tgb.Page() as main_page:
tgb.text("Change the minimum:")
tgb.number("{min_slider}", on_change=change_partial)
tgb.text("Change the maximum:")
tgb.number("{max_slider}", on_change=change_partial)
tgb.text("Value of slider: {value}, minimum of slider: {min_slider}, maximum of slider: {max_slider}")
tgb.part(partial="{slider_partial}")
gui = Gui(main_page)
slider_partial = gui.add_partial(create_slider_partial())
gui.run(port=2552) |
Beta Was this translation helpful? Give feedback.
Would partials help you? It is a way to change a part of your page in real-time.
Here is an unrelated code to explain how partials can be used: