按下特殊键时的jqGrid多选行为 [英] jqGrid multiselect behavior when pressing special key

查看:16
本文介绍了按下特殊键时的jqGrid多选行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对多选行为的期望是只要没有按下特殊键就可以正常运行.我的意思是,如果您选择了一行并单击另一行而没有按下其他键,那么它应该选择新行并取消选择旧行.好吧,jqGrid 的标准选项让您可以在始终常规行为或始终多选之间进行选择.只有在按下特殊键时才能进行多选.

What I was expecting from a multiselect behaviour is to behave just as normal as long as no special key is pressed. I mean, if you have a row selected and click on another with no other key pressed, then it should select the new one and deselect the old row. Well, jqGrid’s standard options lets you choose between always regular behaviour, or always multiselect. You can’t have multiselect only when a special key is pressed.

有什么方法可以实现吗?

Is there a way I can achieve this?

推荐答案

jqGrid有几种选择策略,都使用multiselect:true.为了演示,我创建了三个示例:

jqGrid has several selection strategy, all using multiselect:true. To demonstrate there I created three example:

  1. 如果您只定义 multiselect:true:http://www.ok-soft-gmbh.com/jqGrid/DataToMultiSelect2.htm.这是您不喜欢的标准行为.
  2. 如果你另外定义multiboxonly:true:http://www.ok-soft-gmbh.com/jqGrid/DataToMultiSelect3.htm.在我看来,这种行为正是您所需要的.
  3. 如果您另外定义 multikey:"ctrlKey": http://www.ok-soft-gmbh.com/jqGrid/DataToMultiSelect4.htm.只有在按下 Ctrl 时才会选择或取消选择该行.
  1. If you define only multiselect:true: http://www.ok-soft-gmbh.com/jqGrid/DataToMultiSelect2.htm. This is standard behavior which you not like.
  2. If you define additionally multiboxonly:true: http://www.ok-soft-gmbh.com/jqGrid/DataToMultiSelect3.htm. It seems to me that this behavior is what you need.
  3. If you define additionally multikey:"ctrlKey": http://www.ok-soft-gmbh.com/jqGrid/DataToMultiSelect4.htm. In the case the row will be selected or deselected only if Ctrl are pressed.

如果我正确理解您的问题,您应该同时定义 multiselect:truemultiboxonly:true 以接收您喜欢的行为.

If I understand your question correctly you should define both multiselect:true and multiboxonly:true to receive the behavior which you like.

如果我误解了您的问题,而您的意思是其他意思,请根据上述示例换一种说法.

If I misunderstood your question and you meaned something other please describe this in other words based on on of the above examples.

这篇关于按下特殊键时的jqGrid多选行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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