To execute the example, create an HTML page and perform the following operations:
1. Add links to the following CSS files: PP.css, PP.Metabase.css.
Also, add links to the following JS files: PP.js, PP.Metabase.js, PP.Express.js, and resources.ru.js.
2. Then in the <head> tag add a scenario that will create a dialog box for saving object to metabase:
<script type="text/javascript">
var metabase, eaxMdService, eaxAnalyzer, metabaseDialogBase;
// Function performed on HTML document loading
function onLoad() {
// Specify the path to the rot folder containing resources files
PP.resourceManager.setRootResourcesFolder("../resources/");
// Determine language settings for resources
PP.setCurrentCulture(PP.Cultures.ru);
// Create a repository connection
metabase = new PP.Mb.Metabase({
PPServiceUrl: "/PPService.axd?action=proxy",
Id: "prognozplatform7",
UserCreds: {
UserName: "user",
Password: "password"
}
});
// Open the repository connection
metabase.open();
// Create a service used to work with express reports
eaxMdService = new PP.Exp.EaxMdService({
Metabase: metabase
});
// Open an express report with the 108 key
eaxAnalyzer = eaxMdService.editDocument(108);
// Determine an array of filters for dialog
var filters = [{
Filters: [2561], // Display only express reports
// Specify the resources key used to get filter name
ResourceKey: "openDialogExpressReports"
}];
// Create a dialog used to save object
metabaseDialogBase = new PP.Ui.MetabaseDialogBase({
Metabase: metabase,
FiltersSet: filters, // Array of filters for dialog
CurrentFilter: filters[0], // Current filter
ImagePath: "../build/img/", // Path to dialog icons
ShowOnlyFolders: False, // Display repository folders and objects in the dialog
// Key of the repository folder that must be opened in the dialog
OpenToKey: parseInt(eaxAnalyzer.getParentKey() || 0)
});
metabaseDialogBase.show(); // Display a dialog for saving an object
}
</script>
3. In the <body> tag specify name of the function that creates a dialog box for saving an object to metabase as value of the onLoad attribute:
<body onload="onLoad();"></body>
After executing the example the HTML page will contain the MetabaseDialogBase component:
Only express reports are shown in the dialog box in accordance with the defined filter.
See also: