0

Ig I'm using multiselect:false, each time I'm doing right click, the row keep being selected (aka, it is highlighted no matter how many times I right click on it), yet, once I turn multiselect:true, each time I right click on a given row, it's toggle between selected and none-selected.

Can I keep the selection of a line, no matter how many times I right click on grid row?

The reason is since when I select 3 or 4 rows and than want to perform some right click menu, the row on which I do the right click is toggle back as a none-selected row.

Thanks,

Tal
  • 391
  • 2
  • 11
  • Sorry, but I'm not sure that I understand you correctly. What is your goal and what part which you do is a workaround. You wrote "multiselect:false, each time I'm doing right click". Why you need to change `multiselect` value? Is it a workaround to implement some behavior? Which selection you really need to have in the grid: `multiselect:true` or `multiselect:false`? The default behavior is selection of the row in `contexmenu` handler *only in case `multiselect:false`. – Oleg Jul 03 '15 at 18:57
  • Thanks Oleg, what I'm after is a multi select in which when I'm right click (on any of the selected rows) the operation I'll choose will apply for all selected rows. So if the operation is "delete", it will applied to all rows in the multi selection. The problem is that when I'm doing the right click, the selection is being un-checked from the row on which I performed the right click. – Tal Jul 03 '15 at 19:25
  • Sorry, but jqGrid don't change selection of rows on right mouse click if the option `multiselect:true` are used. So I still not understand your scenario. Probably it would be better if you post small demo and the test case (step by step instructio to reproduce the problem)? – Oleg Jul 03 '15 at 20:08
  • I managed to demo it at http://jsfiddle.net/mrfvsyc2/12/ Than I learned it's due to the fact I'm adding $('#'+gridName).setSelection(rowId); at the end of onContextMenu. So the question is then is there a different workaround to set the value of the specific row id other than using this method? – Tal Jul 03 '15 at 20:48
  • Sorry, but I still don't understand your problem. The code of `onContextMenu` contains the call of `setSelection`. Removing of the call solves your problem. I don't understand your last question: "workaround to set the value of the specific row id". What you want to set? Is it a question about `contextMenu`? I personally use `createContexMenuFromNavigatorButtons` with `jquery.contextmenu-ui.js` plugin instead of `jquery.contextmenu.js`. See [the demo](http://www.ok-soft-gmbh.com/jqGrid/OK/createContexMenuFromNavigatorButtons.htm) from [the answer](http://stackoverflow.com/a/29374787/315935). – Oleg Jul 04 '15 at 10:28
  • Sorry, that was my mistake. – Tal Jul 05 '15 at 06:25

0 Answers0