I am facing a somewhat complicated issue with my web app. I am working on making it more desktop-like by adding features such as dynamically loading information into a DIV based on previously selected items. Currently, I am using a cookie to store the data, but I am struggling to come up with a solution.
The relationships in my scenario are as follows:
SITE has_many BUILDINGS
BUILDING has_many METERS
METER
Each entity can have associated charts. To make it more generic, I have set up a "has_many" relationship for CHARTS and abstracted it accordingly.
SITE has_many CHARTS, as chartable
BUILDING has_many CHARTS, as chartable
METER has_many CHARTS, as chartable
After the user selects an item from the menu, I determine which item needs to display charts and show the relevant item's charts successfully.
My current challenge involves working with cookies to save data to different keys (or maybe Marshal objects) to reload the previously selected item's data dynamically when the page is reloaded. The ajax call requires multiple values for the "update" action to work properly. I'm uncertain whether to use direct Javascript, trigger an action, or combine different approaches to solve this problem.
Although I believe the solution might be simple, I am unable to see it at the moment. If this explanation is unclear, please feel free to ask for further clarification.
Best regards