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?



Hi,
ReplyDeleteNice Work.
Is this on CDF google code last SVN version?
Thanks
Yes, it's commited
ReplyDeleteKnowledge is a treasure, but practice is the key to it.................................................
ReplyDeleteEvery moment of resistance to temptation is a victory.............................................................
ReplyDelete