Posted 1 November 2017, 8:02 pm EST
How can I upgrade this line?
$(“#spreadsheet”).wijspread(“refresh”);
I would like to migrate this line in v10.
how can I migrate this line in spread js v10?
Forums Home / Spread / SpreadJS
Posted by: arnoldbendaa on 1 November 2017, 8:02 pm EST
Posted 1 November 2017, 8:02 pm EST
How can I upgrade this line?
$(“#spreadsheet”).wijspread(“refresh”);
I would like to migrate this line in v10.
how can I migrate this line in spread js v10?
Posted 1 November 2017, 8:56 pm EST
Hello,
With Spread.Sheets v10 you can use the code as:
var spread = new GC.Spread.Sheets.Workbook(document.getElementById(“ss”));
spread.refresh();
Thanks,
Deepak Sharma
Posted 1 November 2017, 9:31 pm EST
hello sir.
I modified as you described.
But I cannot fix it.
so when I replace this code in refresh function I cannot get correct result.
function redraw() {
$timeout.cancel(redrawDelay);
redrawDelay = $timeout(function() {
var fullHeight = $(window).height();
var containerNavbarHeight = $("#container-navbar").outerHeight(true);
var formulaBarHeight = 0;
if ($("#formula-bar").css("display") !== "none") {
formulaBarHeight = $("#formula-bar").outerHeight(true);
}
var statusBarHeight = $("#status-bar").outerHeight(true);
var height = fullHeight - containerNavbarHeight - formulaBarHeight - statusBarHeight;
$("#spreadsheet").height(height);
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("spreadsheet"));
spread.refresh();
}, 5);
}
when I redraw the page I can get this result.
https://drive.google.com/file/d/0BzEc51fOoK5kajY5UVA5ZFVCSzQ/view?usp=sharing
How can I fix this?
Posted 12 November 2017, 8:40 pm EST
Hello,
I am not sure what action are you performing exactly. Spread.Refresh() method is used to manually refresh the layout and rendering of the Workbook object.
In your code you are creating a new instance of Spread and then refreshing it. But I believe you would want to refresh some existing Spread sheet on browser.
To do that you can create a global ‘spread’ variable so that you do not need to create it’s instance everytime you need to access it. For example:
<script type="text/javascript">
var spread;
window.onload = function () {
spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
var activeSheet = spread.getActiveSheet();
activeSheet.setRowCount(7);
activeSheet.setValue(0, 0, "23");
activeSheet.setValue(1, 0, "11");
activeSheet.setValue(2, 0, "34");
activeSheet.setValue(3, 0, "11");
activeSheet.setValue(4, 0, "34");
activeSheet.setValue(5, 0, "23");
activeSheet.setValue(6, 0, "23");
}
function refresh()
{
spread.refresh();
}
</script>
<body>
<div id="ss" style="width:100%; height:400px;border: 1px solid gray"></div>
<input type="button" id="button1" value="button1" onclick="refresh()"/>
</body>
Thanks,
Deepak Sharma