0

when I doubleclick on the row, it will give edit popup. This edit popup has left and right error key, when I click on that Arrow key , it will select the row in background. so I want to prevent the Auto select row when click of JQGrid Editpopup's Next and previous button.enter image description here

so when I click on the next button it will select the row in my Grid table.How do I prevent this behavioir? in below image it mention

enter image description here

Please help me. I have tried "onclickPgButtons", but not able to trigger it.

Thanks in Advance.

user223614
  • 303
  • 1
  • 6
  • 15

1 Answers1

0

You can't prevent selection of the new row, but you can just call setSelection with just selected row to unselect it. The code of afterclickPgButtons could be the following

afterclickPgButtons: function (whichButton, $frmgr, justSelectedRowid) {
    $(this).jqGrid("setSelection", justSelectedRowid);
}

See the corresponding demo here.

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Thats what I need is.But I am not able to understand where should I put the code in my jqgrid.Following is my function of jqgrid. ondblClickRow: function(rowid) { jQuery(this).jqGrid('editGridRow', rowid, {recreateForm:true,closeAfterEdit:true, closeOnEscape:true,reloadAfterSubmit:false, title: "Edit Works"}); }}).jqGrid("navGrid", '#workRetrievalResults_Pager', { edit: true, add: false, del: false, search: true, refresh: true, cloneToTop: true }, – user223614 Nov 04 '14 at 18:27
  • @user223614: Just open the source code of [my demo](http://www.ok-soft-gmbh.com/jqGrid/simpleNavGrid2.htm). You need just open the demo, click right mouse button to open the context menu and choose the menu item "View page source" (or some other text like "View source" depend on the web browser which you use). – Oleg Nov 04 '14 at 18:31
  • @Oleg, I know this is an old post but I have the same problem and your demo does not set the selection to only the selected row. I select one row and then in the edit page the "next" and "previous" buttons are still active showing more than just the selected row. Do you know if there is a way to prevent that? Thank you – Daria M Aug 25 '20 at 08:00
  • @DariaM: I'm not sure that you correctly understand the problem described in the answer. I'd recommend you to open the demo in Chrome, open Developer Tools and set breakpoint on the line `$(this).jqGrid("setSelection", justSelectedRowid);` inside of `afterclickPgButtons`. You will see that **the second** row will be selected and the line unselect it. So you probably have another problem. – Oleg Aug 25 '20 at 11:15
  • @Oleg. Oh Ok, I thought user223614 problem was similar to mine. I want to see only the selected records. The "view records" window has those "previous" and "next" buttons and it disconsidered my selection. Even in your demo, those buttons are not deactivated when checking only one row. To me this is problematic, because it a user has a table on 10 rows, wants to view records of 2, 5 and 8 when he openes the view records window he expects that by pressing "next" he will see record number 5, instead jqgrid delivers the next row, which is nr 3. Is there a way to view only the selected records? – Daria M Aug 25 '20 at 12:35
  • @DariaM: If you don't need "previous" and "next" buttons in add/edit/view, you can use `viewPagerButtons: false` option in the corresponding options of `navGrid` parameters. See https://stackoverflow.com/a/6499309/315935 for some code example, which set the options. Alternatively, you can include `$.extend($.jgrid.edit, {viewPagerButtons: false});` or/and `$.extend($.jgrid.view, {viewPagerButtons: false});` to change default value of `viewPagerButtons` from `true` to `false`. – Oleg Aug 25 '20 at 12:52
  • @ Oleg, thank you so much for the replay. I am trying this right away. – Daria M Aug 25 '20 at 12:59