Adding menu items involves three files:
| • | The actionModel file for the menu item. |
| • | The properties file that labels the menu item. |
| • | An action file that handles events for the menu item. |
This example adds a special menu item so that MyCompany employees can easily find their accounts reports.
| 1. | Edit the file <js-webapp>/WEB-INF/actionModel-navigation.xml. Locate the actionModel for the View menu near the beginning of the file. |
| 2. | Add a separator tag and an option tag for the menu item. The option tag has attributes to specify the label key and the name of the action to perform. |
| 3. | Open one of these files. The name of the properties file depends on your edition of JasperReports Server: |
Commercial Editions: | <js-webapp>/WEB-INF/bundles/pro_nav_messages.properties |
Community Project: | <js-webapp>/WEB-INF/bundles/jasperserver_messages.properties |
The names of the keys are slightly different depending on the file. The following example is based on the contents of the commercial edition pro_nav_messages.properties.
| 4. | Add the line for the NAV_028_ACCOUNTS property with an appropriate value, in this case MyCompany Accounts. |
| 5. | If you support multiple locales, add the same message key to the other language bundles. |
| 6. | Edit the file <js-webapp>/scripts/actionModel.primaryNavigation.js. |
| 7. | Add a URL and parameters to load the desired page in response to selecting the new accounts menu item. In the case of this example, the action is to perform a search for all reports with the word account in their name or description. |
| 9. | When the web app has reloaded, log into JasperReports Server as joeuser. You can see the View > MyCompany Accounts menu item was created and selecting it performs a customized search. The following figure shows both the menu item and the search results on the same page. |
Custom Menu Items and Corresponding Action |
|
Recommended Comments
There are no comments to display.