StatCoeffTabSheetSource: PP.TS.StatTabSheetSource;
The StatCoeffTabSheetSource property sets data source for a sheet in the Equation tab of statistics panel.
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:
//Add a handler for repository connection end event, which
//sets availability of the Delete Selected Series button
metabase.EndRequest.add(PP.Delegate(function(){
function isButtonEnabled(series)
{
for (var i = 0; i < series.length; i++)
{
if (series[i].kind == PP.TS.Ui.LnSerieKind.Derived)
{
var parentK = series[i].parent.k;
var parentFound = false;
for (var j = 0; j < series.length; j++)
{
if (series[j].k == parentK)
{
parentFound = true;
break;
}
}
if (!parentFound)
return false;
}
}
return series.length > 0;
};
var series = wbk.getActiveSheet().getSelectedSeries();
if(isButtonEnabled(series))
{
removeSerieButt.setEnabled(true);
}
else
{
removeSerieButt.setEnabled(false);
}
}));
var removeSerieButt = new PP.Ui.Button({
ParentNode: document.body, //Parent DOM node
Content: 'Delete selected series', //Signature
Click: PP.Delegate(onClickRemoveSerie)
});
function onClickRemoveSerie()
{
//Get selected workbook series
var series = wbk.getActiveSheet().getSelectedSeries();
//Create a body of server request to delete selected series
var body =
{
SetWbkMd:
{
tWbk: wbk.getOdId(),
tArg:
{
meta:
{
series:
{
its:
{
it: series
}
}
},
pattern:
{
series: "Remove"
},
metaGet: tsService._getGeneralSeriesPattern()
}
}
};
//One should get tabsheet structure to set correct width and height of the remaining series
body.SetWbkMd.tArg.metaGet.getTabSheet = {
pattern: {
DHTML: true,
structure: true
}
};
//Get data that was changed
var tcd = wbk.getTableChangedData();
if (tcd)
{
var newtcd = { c: [] };
for (var i = 0; i < series.length; i++)
{
var index = wbk.getRealIndex(undefined, series[i]);
for (var j = 0; j < tcd.c.length; j++)
{
if (tcd.c[j]["@row"] != index)
{
if (tcd.c[j]["@row"] > index)
{
tcd.c[j]["@row"]--;
}
newtcd.c.push(tcd.c[j]);
}
}
}
//set changed data of express report title.
wbk.setTableChangedData(newtcd);
}
//Set number of workbook series
wbk.setSeriesCount(wbk.getSeriesCount() - series.length);
//Refresh list of series
wbk.updateSeriesList(series, true);
//Check if the number of workbook series is not equal to 0
if (wbk.getSeriesCount() == 0)
{
wbk.setSelectedSeries([]);
}
//Add information about parent series into body of server query
if (series[0].parent)
{
var parentSerie = wbk.getSerie(series[0].parent.k);
body.SetWbkMd.tArg.metaGet.seriesFilter = {
range: {
start: wbk.getRealIndex(undefined, parentSerie),
count: wbk.getLoadedChildrenCount(parentSerie) + 1
}
};
}
else
{
body.SetWbkMd.tArg.metaGet.seriesFilter = {
range: {
start: -1,
count: 0
}
};
}
//Set whether workbook is changed
wbk.setIsChanged(true);
//Set whether update is required
wbk.setNeedUpdateSelection(true);
//Set data source for sheet on the Correlation Matrix tab on statistics panel
wbk.setStatCorrTabSheetSource(undefined);
//Set data source for sheet on the Equation tab on statistics panel
wbk.setStatCoeffTabSheetSource(undefined);
//Set data source for sheet on the Weight Matrix on statistics panel
wbk.setStatWeightsTabSheetSource(undefined);
tsService._addViewSettings(wbk, body.SetWbkMd);
//Send query to server
tsService._invokeRemoteProc(wbk, body, PP.Delegate(onResponse));
}
function onResponse(sender, args)
{
//Refresh the workbookBox component
workbookBox.refreshAll();
}
After executing the example a button named Remove Selected Series is placed in the HTML page. Clicking this button removes selected series. To ensure that the button is available, selected series must not include child series whose parent is not selected.
See also: