{
name: "xsheet",
rows: [
{
index: 0,
cells: [{ index: 0, value: 123 }]
},
{
index: 1,
cells: [{ index: 0, formula: "=A1 + 2", value: 125 }]
},
{
index: 4,
cells: [{ index: 3, formula: "=A1 + A2", value: 248 }]
}
]
};As you can see, I set the "value" prop right away so that Syncfusion spreadsheet doesn't calculate it itself. I need to rely solely on the data and calculations results provided by GSheets API.
3. When the cell is being edited, I need to prevent saving the new value, but instead send that value through GSheets API and receive updated sheet values.
4. The last part which I have problem with, is setting those values on a sheet. But my issue is that when I set it by updating "sheets" props, the sheet is being rerendered and for example it gets scrolled up.
I want to preserve scroll position, selection etc., just silently update displayed values for the recalculated ones received from API.
How to do that? I wasn't able to find a proper way to update range or the whole sheet in documentation.
Best Regards!
|
updateValue() {
let cell = this.spreadsheet.getActiveSheet().activeCell; // to get active cell
this.spreadsheet.updateCell(
{ value: document.getElementById("ssValue").value },
cell
);
}
|
|
updateValue() {
let sheet = this.spreadsheet.getActiveSheet(); // to get active sheet
let cell = sheet.activeCell; // to get active cell
let data = [
{ Key1: document.getElementById("ssValue").value, Key2: "Your value" },
{ Key1: document.getElementById("ssValue").value, Key2: "Your value" }
]; // construct the datasource
sheet.ranges[0] = {
dataSource: data,
startCell: cell
}; // to update the range in spreadsheet
this.spreadsheet.refresh(); // to refresh the spreadsheet with the modified changes
}
|