我是 Handsontable 的新人,非常新,抱歉。
我必须修复一个错误,但我不知道该怎么做。
我正在使用以下代码:
$('#tableDiv').on('click', 'td input.htCheckboxRendererInput', function (event) {
console.log("chosen a row");
var selection = $("#tableDiv").handsontable('getInstance').getSelected();
$.each($( this ).closest('td').siblings('td'), function(){
console.log($(this).text());
});
var indice=$( this ).closest('td').siblings('th').text();
console.log("indice della riga:"+indice);
console.log(TABLE_DATA[indice-1]);
TABLE_DATA_PROMOTE.push(TABLE_DATA[indice-1]);
});
这适用于 Firefox,但不适用于 IE 和 Chrome。
谁能帮我解决这个问题吗?
最佳答案
无论问题是什么,我建议使用 events provided by Handsontable 。特别是,您正在寻找:
afterSelection (r: Number, c: Number, r2: Number, c2: Number)
选择一个或多个单元格时(鼠标移动时)会触发回调。参数:
r selection start row
c selection start column
r2 selection end row
c2 selection end column
您可以轻松地看到这可以用来复制您的代码。请注意,如果您一次选择多个单元格,则 r2
和 c2
与 r
和 c
不同,我认为在你的情况下是无关紧要的。
关于jquery - Handsontable 不适用于 IE 和 Chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29653232/