use*_*621 3 javascript excel getselection handsontable
我正在使用handsontable创建一些类似excel的电子表格,我需要检索用户选择的数据以使用gRaphael创建图表.但是当我尝试使用此代码甚至警告数据选择参数时:
var ht = $('#dataTable0').data('handsontable');
var sel = ht.getSelected();
alert(sel[0]);
Run Code Online (Sandbox Code Playgroud)
我在警报窗口中写了"未定义".有人能告诉我如何修复此代码吗?
Pos*_*ing 16
您的代码已过时,这可能是它无法按预期工作的原因.如果您使用的是最新版本0.9.7,建议使用的方法是:
$('div#example1').handsontable(options);
//get the instance using jQuery wrapper
var ht = $('#example1').handsontable('getInstance');
//Return index of the currently selected cells as an array [startRow, startCol, endRow, endCol]
var sel = ht.getSelected();
//'alert' the index of the starting row of the selection
alert(sel[0]);
Run Code Online (Sandbox Code Playgroud)
如果您使用的是旧版本,我建议您下载最新版本.
编辑:
正如@polras所建议的那样,您还可以添加:
outsideClickDeselects: false
Run Code Online (Sandbox Code Playgroud)
以handsonetable选项
| 归档时间: |
|
| 查看次数: |
10311 次 |
| 最近记录: |