简体   繁体   English

Wijmo SpreadJS中的事件处理

[英]Event handling in Wijmo SpreadJS

I'm using Wijmo SpreadJS and I'm trying to implement event handling. 我正在使用Wijmo SpreadJS,并且正在尝试实现事件处理。 So, basically I want to control cell clicking. 因此,基本上我想控制单元格单击。

This is how my code looks like: 这是我的代码的样子:

$(document).ready(function () {
  // code here //

  initSpread();

});

function initSpread(){
  // code here //
};

$("#ss").wijspread();
var spread = $("#ss").wijspread("spread");
var activeSheet = spread.getActiveSheet();

activeSheet.bind($.wijmo.wijspread.Events.CellClick, function (sender, args) {
    alert("Cell "+args.col+args.row+" clicked");
});

This is returning the error: 这将返回错误:

Uncaught TypeError: Object [object Object] has no method 'getActiveSheet'

What is wrong with this code? 此代码有什么问题? Thanks in advance for help. 在此先感谢您的帮助。

When you create instance of spreadjs, you should give a sheet count, otherwise there is no sheet in spreadjs. 在创建spreadjs实例时,应提供工作表计数,否则spreadjs中将没有工作表。 $("#ss").wijspread({sheetCount:1}); $(“#ss”)。wijspread({sheetCount:1});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM