Example of Creating the DimensionTree Component

To execute the example, in the HEAD tag of the HTML page add links to the following JS and CSS files:

The repository must contain a dictionary with the key 97.

<body>
    <div id="example"></div>
        <script type="text/javascript">
            //Determine resources folder
                        PP.resourceManager.setRootResourcesFolder("../resources/");
            //Determine language settings
            PP.setCurrentCulture(PP.Cultures.ru);
            //Create a metabase connection
            var mb = new PP.Mb.Metabase({
                PPServiceUrl: "PPService.axd?action=proxy",
                Id: "PPRepository",
                //repository objects are not cached
                EnableCaching: false,
                UserCreds: {
                UserName: "user",
                Password: "password"
            }
            });
            mb.open();
            var param = new PP.Mb.Param({
                Id: "param",
                Key: 2,
                Name: "Parameter",
                Value: 12,
            });
            var pattern = {
                getDescr: true,
                getAttrs: true,
                getLevs: true,
                getHiers: true,
                getGroups: true,
                getSchemas: true,
                getSelection: true
            }
            //Create a service used to work with dimensions
            dimSrv = new PP.Mb.DimService({ Metabase: mb });
            var dim = dimSrv.open(97, false, true, pattern, function (sender, args) {
                console.log("Dictionary is opened");
            }, param, "{ Value: \"1\", Type: \"NAME\" }");
            //Create the DimensionTree component
            var dimTree = new PP.Mb.Ui.DimensionTree({
                Source: dim,
                ParentNode: document.getElementById("example"),
                Width: 400,
                Height: 400,
                Service: dimSrv,
                MultiSelect: false
            });
       </script>
</body>

After executing the example the HTML page will contain the DimensionTree component that displays tree of a specified dictionary, such as:

The console displays a message about dictionary opening:

Dictionary is opened

 

Multiple selection of elements is disabled for this tree.

See also:

DimensionTree