setSelectedAttributes (selectedAttrs, fireEvent);
selectedAttrs. Sets attributes order.
fireEvent. Determines whether to fire the RequestSelectedItemsChanged event. If the parameter is set to True (default), the event is fired, if the parameter is False - the event is not fired.
The setSelectedAttributes method calculates order of selected attributes for breadcrumb chain.
To execute the example, the page must contain the WorkbookBox component named workbookBox (see Example of Creating the WorkbookBox Component), and also add the following code in the handler, that processes document opening event:
//Get component for displaying and managing workbook attributes
var breadcrumb = workbookBox.getDataView().getBreadcrumb();
//Create array of selected attributes
var selItems = [];
//Get current hierarchy
var hie = breadcrumb.getSource();
var levs = hie.getLevels();
var brCrAtts = hie.getSelectedBreadcrumbAttributes(); //Attributes selected in breadcrumb
//Select all hierarchy attributes
for (var k = 0; k < levs.length; k++)
{
if (brCrAtts != null && k >= brCrAtts.length)
break;
var atts = levs[k].atts.its.it;
if (atts.length > 0)
{
selItems.push({
Id: atts[0].id,
Key: atts[0].k,
Name: atts[0].n
});
}
}
var removeLastButt = new PP.Ui.Button({
ParentNode: document.body, //DOM parent node
Content: "Remove last breadcrumb node", //Title
Click: PP.Delegate(onClickRemoveLast)
});
function onClickRemoveLast()
{
selItems.pop();
//Calclate order of selected attributes for breadcrumb
breadcrumb.setSelectedAttributes(selItems, false);
//Refresh breadcrumb
breadcrumb.refreshAll();
}
After executing the example a button named Remove Last Attribute in Chain is placed in the HTML page. Clicking this button removes the last selected attribute from the breadcrumb chain.
See also: