redherring917
Posts: 21
Joined: Tue Sep 10, 2024 8:32 pm

Saving user configuration - not data

We’re using the board.getOptions() function to convert the dashboard’s current state to JSON and save it user-specifically to be retrieved next time the user visits. But all we really want to save and retrieve is each user’s dashboard “configuration” if you will - their selected components and their placement within the dashboard – and not necessarily the data as each visit to the dashboard should pull current data via database queries to populate the components.

How would you recommend accomplishing this? Would we perhaps save the dashboard JSON with the dataPool content stripped out and spec that part of the JSON each time the dashboard loads such that current data is loaded? Or can we somehow save the entire dashboard JSON but make an additional dataPool specification on load that would “overrule” that which is pulled from the saved JSON (not sure what would happen if 2 dataPool’s were spec’d in JSON like this)?

Hopefully you understand what I’m looking for – it seems like it shouldn’t be a terribly unique situation / request.

Thanks!
andrzej.b
Posts: 146
Joined: Mon Jul 15, 2024 12:34 pm

Re: Saving user configuration - not data

Hi,

Thanks for contacting us with your question!

As you correctly expected, you can separate dashboard configuration saving from the data. I have prepared for you a sample fiddle with mock scenario where config is saved with board.getOptions(), data part is removed (you can either delete just data or the whole dataPool config, depending on your use case needs);
board destroy mock new session, then you can load saved options and data, merge them and create board on the spot.

https://jsfiddle.net/BlackLabel/bksopgvq/

I hope you will find it useful.

Best regards,
Andrzej
redherring917
Posts: 21
Joined: Tue Sep 10, 2024 8:32 pm

Re: Saving user configuration - not data

Thanks for the reply. With your input and a bunch of semi-ignorant mucking around on my part, did manage to get this to work. :)

Thanks again!

Return to “Highcharts Dashboards”