getCurrentState ();
The getCurrentState method returns object of the current state of the Calculation Periods panel component.
To execute the example, the page must contain the WorkbookBox component named workbookBox (see Example of Creating the WorkbookBox Component) and a workbook with the 5183 key. Add the following code in the handler that processes document opening:
//Get the panel. which must contain the Calculation Periods panel var equationPeriodPanel = workbookBox.getPropertyBarView().getEquationPeriodPanel(); //Request a new workbook var NewKEY = 5183; tsService.editDocument(NewKEY, onSecondOpened); function onSecondOpened(sender, args) { //Get a new data source var wbk2 = args.Workbook; //Set the selected series in the new data source tsService.setSelectedSeries(wbk2, [1], [0]); var setSourceButt = new PP.Ui.Button({ ParentNode: document.body, //DOM parent node Content: "Set Source", //Text Click: PP.Delegate(onClickSetSource) }); function onClickSetSource() { //Set a new data source for the Calculation Periods panel equationPeriodPanel.setSource(wbk2); //Refresh equationPeriodPanel.refresh(); } equationPeriodPanel.ControlChanged = new PP.Delegate(onStateChanged); function onStateChanged(sender, args) { //Get CurrentState of the Calculation Periods panel var state = equationPeriodPanel.getCurrentState(); alert(JSON.stringify(state)); } }
After executing the example the HTML page will contain the WorkbookBox component and a button named Set Source. To execute the example, open the workbook side panel, select the Series tab and open the Calculation Periods panel. Next click the Set Source button. Calculation period changes: calculation period for the workbook with the 5183 will be set in the panel.
See also: