addItem(source: PP.Rds.Dictionary, settings: Object, setActive: Boolean, replace: Boolean);
source. MDM dictionary to be loaded.
settings. Settings for dictionary controls. If these are not specified, default settings are used.
setActive. Indicates if the added dictionary will be active. If this parameter is true the dictionary will be active, otherwise it will be not (default).
replace. Indicates if the dictionary with the same key should be replaced. If this parameter is true the MDM dictionary with the same key is replaced with the specified one, otherwise it is not replaced (default).
The addItem method adds a tab with a specified MDM dictionary, or refreshes the dictionary with the same key on an available tab.
This method returns true if a new tab is added; the replaced PP.Rds.Dictionary object if the MDM dictionary is refreshed; and false if no operation is performed.
To execute this example, the page must contain the DictionaryBox component named dictionaryBox (see Example of creating the DictionaryBox component ). Clear all open MDM dictionaries, next add the dictionary with the key 8096 to the container data area. Also process the ActiveTabChanged event and hide the attributes history panel if it is shown, or show it if it is hidden:
// Get MDM dictionary var source = dictionaryBox.getSource()[0]; // Get service to work with dictionary var service = source.getPPService(); // Get dictionary data area var dataArea = dictionaryBox.getDataArea(); // Clear all opened dictionaries dataArea.clear(); // Process the ActiveTabChanged Event dataArea.ActiveTabChanged.add(function (sender, args) { console.log("The other MDM dictionary is current"); }); // Set dictionary key var key = 8096; // Open the MDM dictionary with the 8096 key var dimenstionsSource = service.openRds(key, null); // Add the opened dictionary to the data area dataArea.addItem(dimenstionsSource, null, true, true, false); // Collapse the panel with attribute value history if (dataArea.getIsHistoryCollapsed(key)) { dataArea.expandHistory(key); } else { dataArea.collapseHistory(key); };
After executing the example all the loaded MDM dictionaries are cleared, and the dictionary with the key 8096 is added. Attribute history panel is hidden:
The browser console shows key and ID of the opened MDM dictionary, and a warning that the current MDM dictionary has been changed, due to handler of the ActiveTabChanged event:
Key of the open dictionary: 8096
ID of the open dictionary: UNITS_SYSTEMS
Another MDM dictionary has become the current dictionary
See also: