MetaAttribute.removeFromSelected

Syntax

removeFromSelected (callback);

Parameters

callback. Method to execute after attribute is deleted in the server.

Description

The removeFromSelected method removes attribute from the list of selected attributes.

Example

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:

	var brCr = workbookBox.getDataView().getBreadcrumb();				
	var mattr = brCr.getMetaAttributes().getItem(0);
	var item = mattr._BreadcrumbItem;
	//Get the PP.TS.Ui.MetaAttribute object by attribute identifier
	var metaattr = brCr.getMetaAttributeById(item.getId());				
	//Get drop-down panel corresponding to attribute from the obtained attribute
	var panel = metaattr.getDropPanel();
	//Expand panel
	showPanel();
	var attr = metaattr.getAttribute();
	alert("Name of the attribute, for which panel is expanded - " + attr.n);
	//To show working of the getTree() method of the PP.TS.Ui.MetaAttribute class of the object named metaattr, get 
	//attribute dimension tree
	var dimTree = metaattr.getTree();
	//Set selection to all dimension tree nodes
	dimTree.selectAll();
	//Refresh all tree structure
	dimTree.refreshAll();
	//All dimension tree nodes are selected on the drop-down panel. 
				
	var removeSelButt = new PP.Ui.Button({
		ParentNode: document.body, //DOM parent node
		Content: "Remove selection", //Text      
		Click: PP.Delegate(onClickRemoveSel)     
	});			
	function onClickRemoveSel(){
		//Remove selected attributes
		mattr.removeFromSelected(); 
		showPanel();
	}		
				
	function showPanel()
	{
		//Calculate coordinates of the top left corner of the drop-down panel 
		var visibilityObject = panel.isVisibleArea(0, 0);
		var coords = PP.calculateOffset(item._DomNode);
		var top = coords.Y + item._DomNode.offsetHeight + 1;
		var left = 0;
		if (brCr.getIsRTL())
			left = coords.X + item._DomNode.offsetWidth - visibilityObject.Width + 1;
		else
			left = coords.X - 1;	
		//Display the drop-down panel in the specified place
		panel.show(left, top);					
	}

After executing the example the following objects are placed on the HTML page: WorkbookBox component, a drop down panel corresponding to the metaattribute received with the getMetaAttributeById method, and a button named Remove Selection. A message showing name of the attribute for which the panel is expanded, appears in the screen. Double click on this button removes selection from all dimension tree nodes.

See also:

MetaAttribute