Rym Guerbi Michaut
Rym Guerbi Michaut

Reputation: 193

“reloading” context in Taipy

I was wondering what the best way to reload a context is.

I load a context from a file when I start my application.

When I reload some other data on the fly (using an upload button), most of the changes (if not all) can not be seen. I kown I could use a partial and reload everything but I was wondering if there was a better way to do it.

On the page there is two drop list, a line chart, and a Gantt chart.

I’d like to change the dropdown and chart content according to the upload.

A pseudo code of what I’ve got is :

data = load_file(local_sample_file)

def onUpload(state):
state.data = load_file(state.uploadedfile) <- the part that does nothing on its own

launch_app

I could put the entire gui content in a partial, but I was wondering if there was a more elegant way to do it.

Regards,

Upvotes: 1

Views: 705

Answers (1)

Florian Jacta
Florian Jacta

Reputation: 1521

The problem comes from your data's structure changing (the column names are different...). You can now use a new parameter in Taipy 2.2 that will allow you to rebuild your chart or table based on the new structure. From the documentation:

Allows dynamic config refresh if set to True.

So, add to the elements that need to be rebuilt like charts or tables, this parameter:

<|{data}|chart|rebuild|>

<|{data}|table|rebuild|>

Upvotes: 0

Related Questions