DItem.getHistory

Syntax

getHistory();

Description

The getHistory method gets an array of PP.Rds.DItem objects, that show attributes history for MDM dictionary element.

Example

To execute this example, the page must contain the DictionaryBox component named dictionaryBox (see Example of creating the DictionaryBox component ). Determine history for the first child element:

// Get MDM dictionary
var source = dictionaryBox.getSource()[0];
// Get service used to work with dictionary
var service = source.getPPService();
// Get dictionary child elements
var childEls = source.getChildEls();
if (source.isHistorical()) {
    // Get changes history for attribute values for the first child item
    var history = childEls[0].getHistory();
    for (var i = 0; i < history.length; i++) {
        // Get attribute values
        var attrsValues = history[i].getAttrValues();
        console.log("Start date: %s, end date: %s", attrsValues[6], attrsValues[7]);
    };
} else {
    console.log("Dictionary is not versional");
};
//Determine whether dictionary is multilingual
console.log(source.isMultilingual ? "Dictionary is multilingual" : "Dictionary is not multilingual");

After executing the example attributes history for the first child element is shown in the browser console:

Start date: 2013-10-31, end date: 2999-12-31


An appropriate notice is shown if the MDM dictionary is not versioned, that is, its element cannot change in time.

See also:

DItem