SpreadJS Documentation > Sample Code > Sample Code for Frequently Used Events > Using Events when the Top Row or Column Changes |
You can use events when the top row or column changes when scrolling.
This example uses the TopRowChanged and LeftColumnChanged events.
JavaScript |
Copy Code
|
---|---|
var spread = new GcSpread.Sheets.Spread($("#ss").get(0),{sheetCount:3}); spread.addSheet(); var sheet1 = spread.getSheet(0), sheet2 = spread.getSheet(1); sheet1.bind(GcSpread.Sheets.Events.TopRowChanged, function (sender, args) { //Set the displayed top row of sheet1 to sheet2 (vertical scroll synchronization). sheet2.showRow(args.newTopRow, GcSpread.Sheets.VerticalPosition.top); }); sheet1.bind(GcSpread.Sheets.Events.LeftColumnChanged, function (sender, args) { //Set the displayed left column of sheet1 to sheet2 (Horizontal scroll synchronization). sheet2.showColumn(args.newLeftCol, GcSpread.Sheets.HorizontalPosition.left); }); |