Wednesday, August 4, 2010

Persistence options in CDF dashboards

This is something insanely useful that's been in the todo list for ages. Now, thanks to our CDI methodology (CDI as in Customer Driven Improvement, not yet another project :) ) it's there already.


The principle is simple: You access a dashboard, define a set of filters that leads you to your favorite view. Next time you access the same one (or just do a refresh) you need to start all over again? Not anymore.


Now we can easily tell CDF to remember the options set by the user. Let's take the SelectComponent example:


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);}
};


This gives you the standard, boring yet most useful select component. Now, what changes are required for the user to see the last option he selected the next time he accesses the dashboard? Marked in bold:


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);}
};


And now, if the user selects Dusseldorf, this is what he'll see the next time he accesses that dashboard:




No need to say that this can be used for a lot more than simple selectors - up to your imagination.


Can this get any easier?

4 comments: