setSeriesAttr (wbk, series, callback);
wbk. Sets workbook value.
series. Sets series.
callback. Sets handler for operation execution end.
The setSeriesAttr method sets series attributes.
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 setSeriesAttrButt = new PP.Ui.Button({ ParentNode: document.body, //DOM parent node Content: "Determine Set of Attributes", //text Click: PP.Delegate(onClickSetSeriesAttr) }); function onClickSetSeriesAttr() { //Set workbook value var wbk = args.Workbook; //Get the first workbook series var serie = [wbk.getActiveSheet().getSeries()[0]]; var firstVisiblearrtibute; //Get the first visible and non-predefined attribute of the first series var origAttributes = serie[0].atts.its.it for (var i = 0; i < origAttributes.length; i++) { if (origAttributes[i].predefined == False && origAttributes[i].vis == True) { firstVisiblearrtibute = { dt: origAttributes[i].dt, id: origAttributes[i].id, k: origAttributes[i].k, n: origAttributes[i].n, predefined: False, value: "" } break; } } //Create an object used as a parameter for the setSeriesAttr method series = [{ k: serie[0].k, atts:{its:{it: [firstVisiblearrtibute]}}, id: serie[0].id, kind: serie[0].kind, selectedUnit: "" }]; //Set first series attributes tsService.setSeriesAttr(wbk, series, PP.Delegate(onSetAttr, this)); //Sets method execution end handler function onSetAttr(){ //Refreshes table var gridView = workbookBox.getDataView().getGridView(); gridView.getInstance().reset(); }; }
After executing the example the Define Attributes Set button is placed in the HTML page. To execute the example, select the first series in the workbook, in the Series tab of the side panel open the Attribute Series panel to edit, next select value for the first attribute and click the Define Attributes Set button. After clicking this button data in the workbook first series changes, and the value, selected in the panel used for editing values of selected series' attributes is reset. It is indicated by the text "Selected (0)" in the text entry box.
See also: