使用Handsontable时如何强制将选定的单元格置于编辑模式? [英] When using Handsontable how to force a selected cell into edit mode?

查看:341
本文介绍了使用Handsontable时如何强制将选定的单元格置于编辑模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Handsontable为选中一个单元格提供了一些不错的方法,但是我似乎想不出办法,让我在选中某个单元格后将其强制进入编辑模式.

Handsontable provides some nice hooks for when a cell is selected but I can't seem to figure out way to get it to allow me to force a cell into edit mode when it has been selected.

我可以这样检测单元格选择:

I can detect the cell selection like this:

Handsontable.PluginHooks.add( 'afterSelection', function( row, column ) {
    var current_td = this.getCell( row, column );
});

然后从那里我甚至可以获得所选择的单元格元素.但是从那里我似乎无法触发该单元格进入编辑模式(其中有一个活动选择的textarea字段).通常,这是通过双击触发的.做显而易见的事情似乎不起作用:

And from there I can even obtain the cell element that was selected. But from there I can't seem to trigger the cell into edit mode (where it has an actively selected textarea field inside of it). This is normally triggered by a double click. Doing the obvious doesn't seem to work:

Handsontable.PluginHooks.add( 'afterSelection', function( row, column ) {
    var current_td = this.getCell( row, column );

    $(current_td).dblclick();
});

其他任何人都曾经做过,或者对我如何使它起作用有想法?

Anyone else ever done this or have thoughts on how I might get it to work?

推荐答案

我相信我已经回答了自己的问题:

And I believe I've answered my own question:

Handsontable.PluginHooks.add( 'afterSelectionEnd', function() { 
        f2_event = $.Event( 'keydown', { keyCode: 113 } );
        this.$table.trigger(f2_event);
});

这似乎可以解决问题.

这篇关于使用Handsontable时如何强制将选定的单元格置于编辑模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆