Workbook.addSelectedSeries

Syntax

addSelectedSeries (value);

Parameters

value. Sets a series or series array.

Description

The addSelectedSeries method adds series to an array of selected series.

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 gv = workbookBox.getDataView().getGridView();//._TabSheet	
	var addSelectedSeries = new PP.Ui.Button({
		ParentNode: document.body, //DOM parent object
		Content: "AddSelectedSeries", //text 					
		Click: PP.Delegate(AddSelectedSeriesOnClick)
	});	
		function AddSelectedSeriesOnClick()
		{
			//Get an instance of the PP.TS.Workbook class
			var source = wbk.getActiveSheet();
			//Get array of series of workbook data model
			var series = source.getSeries();
			//Remove all selected series from the array of selected workbook series
			source.removeAllSelectedSeries();
			//Select all chosen series
			for (var i = 0; i<series.length; i++)
			{					
				wbk.addSelectedSeries(series[i]);					
			}
		
			var selSers = wbk.getSelectedSeries();				
			selectedIndexSeries = new Array();
			for (var i = 0; i < selSers.length; i++)
			{
				selectedIndexSeries.push(selSers[i].index);
			}							
				
			var selectedIndexCols = new Array();				
			for (var i = 0; i < gv._TabSheet._Model._Measures._MaxColumn; i++)
			{
				selectedIndexCols.push(i);
			}	
			//Set selected workbook series
			tsService.setSelectedSeries(wbk, selectedIndexSeries, selectedIndexCols, function (){});
			//get arrays of selected workbook series and columns
			var selRows = source.getSelectedIndexSeries();
			var selCols = source.getSelectedIndexCols();
			//Select component to display workbook table (LanerBox)
			gv._GridSelection._SelectedAreas[0].Range._Corners.blCoord.colIndex = selCols[0]+2; 					
			gv._GridSelection._SelectedAreas[0].Range._Corners.blCoord.rowIndex = selRows[selRows.length-1]+1;
			gv._GridSelection._SelectedAreas[0].Range._Corners.brCoord.colIndex = selCols[selCols.length-1];
			gv._GridSelection._SelectedAreas[0].Range._Corners.brCoord.rowIndex = selRows[selRows.length-1]+1;
			gv._GridSelection._SelectedAreas[0].Range._Corners.tlCoord.colIndex = selCols[0]+2;
			gv._GridSelection._SelectedAreas[0].Range._Corners.tlCoord.rowIndex = selRows[0]+1;
			gv._GridSelection._SelectedAreas[0].Range._Corners.trCoord.colIndex = selCols[selCols.length-1];
			gv._GridSelection._SelectedAreas[0].Range._Corners.trCoord.rowIndex = selRows[0]+1;
			workbookBox.getDataView()._TabStatPanel.expand();
			workbookBox.getDataView()._TabStatPanel.collapse();					
		}					

After executing the example a button named AddSelectedSeries is placed in the HTML page. Clicking this button selects all series in workbook table.

See also:

Workbook