按下特殊键时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:
- 如果仅定义
multiselect:true
: http://www.ok- soft-gmbh.com/jqGrid/DataToMultiSelect2.htm .这是您不喜欢的标准行为. - 如果另外定义
multiboxonly:true
: http://www.ok- soft-gmbh.com/jqGrid/DataToMultiSelect3.htm .在我看来,这种行为正是您所需要的. - 如果另外定义
multikey:"ctrlKey"
: http://www.ok- soft-gmbh.com/jqGrid/DataToMultiSelect4.htm .在这种情况下,仅在按下 Ctrl 的情况下才选择或取消选择该行.
- If you define only
multiselect:true
: http://www.ok-soft-gmbh.com/jqGrid/DataToMultiSelect2.htm. This is standard behavior which you not like. - 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. - 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:true
和multiboxonly: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.