需要jqGrid内联编辑以将焦点移到单击的单元格上 [英] Need jqGrid inline editing to have focus go to clicked cell
问题描述
其他人问了这个问题,但是我找不到很好的答案.
Others have asked this question, but there's been no good answers that I can find.
- No answer
- Oleg punted to double clicking cells
通过jqgrid和内联编辑,是否可以将焦点集中在所选单元格上而不是该行的第一个单元格上?在onCellSelect
处理程序中,我可以移动焦点,但是焦点会立即返回到该行的第一个单元格.
With a jqgrid and inline editing, is it possible to get the focus on the cell that was selected instead of the first cell on the row? In an onCellSelect
handler I can move the focus, but then it immediately returns to the first cell on the line.
当我退出onCellSelect
回调时,Firebug始终崩溃,因此我在jqGrid源代码本身方面还没有取得太大进展.
Firebug consistently crashes as I step out of the onCellSelect
callback so I haven't made much headway into the jqGrid source itself.
推荐答案
我在此处回答了一个悬而未决的问题.如果您双击进入内联编辑,则可以直接使用我以前的答案.
I answered on the close question here. If you use double-click to enter in the inline editing you can directly use my previous answer.
如果使用对行的选择(onSelectRow
回调),由于当前版本的jqGrid没有将事件对象作为参数,因此将无法检测到被单击的单元格. github 上的jqGrid的最新版本已经具有该参数(请参见修复),您可以在onSelectRow
中执行相同的操作.
If you use selection of the row (onSelectRow
callback) you will have problem to detect the cell which is clicked because the current version of jqGrid don't has the event object as the parameter. The last version of jqGrid on the github are already has the parameter (see my suggestion and the fix) and you can do the same inside onSelectRow
.
如果确实需要使用发布的版本jqGrid 4.3.1,并且需要在onSelectRow
回调中设置焦点,则可以另外使用beforeSelectRow
回调将最后一个e.target
缓存在变量中,并在
If you do need to use released version jqGrid 4.3.1 and need to set focus in the onSelectRow
callback you can use additionally beforeSelectRow
callback to cache last e.target
in a variable and uses it inside of onSelectRow
.
这篇关于需要jqGrid内联编辑以将焦点移到单击的单元格上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!