TSService.editData

Syntax

editData (report, updateSeriesIndex, callback);

Parameters

report. Sets workbook, an instance of the Workbook class.

updateSeriesIndex. Sets array of series indexes for the cells that contain edited data.

callback. Sets handler for operation execution end.

Description

The editData method sends a request to change data stored in cells of workbook table.

Example

To execute the example, the page must contain the WorkbookBox component named workbookBox (see Example of Creating the WorkbookBox Component), and the side panel must be open. The following code must be added in the event handler that processes document opening:

var editDataButt = new PP.Ui.Button({
	ParentNode: document.body, //DOM parent node
	Content: "Change Data", //Text
	Click: PP.Delegate(onClickEditData)
});
var columnIndex = 0;
var res = { c: [] };
function onClickEditData(){
	//Change cell values until all series cells are changed
	while(wbk.getActiveSheet().getWbkMetadata().cellsTable["@columnCount"] > columnIndex)
		{	
			//Create an object with data in cells
			res.c.push({
			"@column": columnIndex,
			"@row": 0,
			"@v": 1,
			"@dt": 3
		});
	columnIndex++;
	//Set a property that stores data to be changed in workbook cells
	wbk.setTableChangedData(res);
	//Send a request for changing workbook table cell data.
	tsService.editData(wbk, [0,2], PP.Delegate(function()
		{
			//Refresh workbook display
				workbookBox.refreshAll();
		}));
		break;
		}
	}

After executing the example a button named Change Data is placed in the HTML page. To execute the example the workbook side panel must be open. On clicking the button the value 1.00 is written to the first cell of the first series, each following click writes the value to the next cell.

See also:

TSService