Configuring Customized User Preference Settings
Some gadgets need to allow users (viewers and editors) to provide user-specific information in the dashboard view mode, without needing to go into the edit mode. In WSO2 DS, the required user preference values are loaded at runtime enabling users to provide the corresponding input. Changes done by dashboard viewers are saved in that respective user's space in the registry. Thereby, enabling viewers who have entered user preferences to view a customized version of the original dashboard. Changes done by dashboard editors are saved in the original registry space of the dashboard. If you want the user preferences to appear in the standard view, the user preferences need to be added in the <UserPref>
tag under the <Module>
section. For more information, click here. The following steps describe how you can define the user preferences of a specific gadget, in a customized settings view:
The following steps are carried out when manually creating a custom gadget or updating a gadget.
- Navigate to the respective gadget folder within the tenant directory.
<DAS_HOME>/repository/deployment/server/jaggeryapps/portal/store/<TENANT_DOMAIN>/<GADGET_NAME>
Example:<DAS_HOME>/repository/deployment/server/jaggeryapps/portal/store/test.com/age_group
Define the customized user preferences view asÂ
view="settings"
 in the<Content>
tag together with the corresponding customizations in the gadget XML.
Example:Â<Module> <Content type="html" view="settings"> <![CDATA[ Define the settings here ]]> </Content> </Module>
When a customized user preference view is defined, WSO2 DAS overrides the default user preferences view and renders the customized user preferences settings view into the gadget. Â
After a user clicks on the settings toggle button, enters the required user preference details, and clicks the toggle button for the second time, those changes will be saved to userPrefs of that particular gadget, and the gadget view will be updated.