取消选择jqGrid中的单行

Mik*_*att 3 javascript jqgrid

这可能不侵入jqGrid JS的内部吗?

setSelection("rowX",false)不起作用,resetSelection()取消选择所有行.

Phi*_*off 8

根据文档,setSelection

切换id = rowid的行选择; 如果onselectrow为true(默认值),则启动onSelectRow事件,否则不启动.

在演示页面上,调用setSelection

jQuery("#list9").jqGrid('setSelection',"13");
Run Code Online (Sandbox Code Playgroud)

这有用吗?你能为我们提供构造函数吗?

  • 这有效.我没有意识到setSelection的第二个参数只决定是否调用onSelectRow.这将满足我的需求,但理想情况下,无论当前状态如何,都会有一种设置行选择的方法. (2认同)