Storage

Description

It's now possible to maintain parameter states between different sessions. Instead of using simple parameters, objects inside the special namespace Dashboards.storage can be saved and restored using the functions described in this page. This works on a per user base, and the developer needs to be aware that the everything saved will be loaded for every dashboard, so if too much is stored one may have some performance penalty

Options

Dashboards.saveStorage()
Saves the contents of the object
Dashboards.loadStorage()
Reloads the object (this is done automatically at dashboard render time, useful only to undo certain operations)
Dashboards.cleanStorage()
Empties the entire storage of that user

Example

Take the SelectComponent example in the component reference section. This is how it is currently:


	regionSelector = 
	{
		name: "regionSelector",
		type: "select",
		parameters:[],
		valuesArray:[["1","Lisbon"],["2","Dusseldorf"]],
		parameter:"region",
		valueAsId: false,
		htmlObject: "sampleObject",
		executeAtStart: true,
		postChange: function(){alert("You chose: " + region);}
	};

			

In order to make this selector persistent, all you need is the following changes:


	regionSelector = 
	{
		name: "regionSelector",
		type: "select",
		parameters:[],
		valuesArray:[["1","Lisbon"],["2","Dusseldorf"]],
		parameter:"Dashboards.storage.region",
		valueAsId: false,
		htmlObject: "sampleObject",
		executeAtStart: true,
		postChange: function(){Dashboards.saveStorage(); alert("You chose: " + Dashboards.storage.region);}
	};