I am using the code below but here are my problems/questions:
- I need to be able to select a row by checkbox, but not more than one row. If I turn off multi-select I get no check boxes.
- Once I select a row by checkbox, how do I query the value of a particular cell in the row to use to sen to another php module?
$grid[“multiselect”] = true;
$grid[“beforeSelectRow”] = “function(rowid, e) { return $(e.target).is(‘input[type=checkbox]’); }”;
P.S. I may be going about this the wrong way. I need to select a row, but since I’m color formatting the rows, I can’t see any indication that I’ve selected a row.So I thought that the checkbox would be an alternative. I’m using this code to color the rows:
$col["column"] = "status"; $col["op"] = "eq"; $col["value"] = "InProcess"; $col["css"] = "'background-color':'yellow', 'color':'black'"; $col_conditions[] = $col; $col["column"] = "status"; $col["op"] = "eq"; $col["value"] = "VisitReady"; $col["css"] = "'background-color':'lightgreen', 'color':'black'"; $col_conditions[] = $col; $col["column"] = "status"; $col["op"] = "eq"; $col["value"] = "VisitCompleted"; $col["css"] = "'background-color':'springgreen', 'color':'black'"; $col_conditions[] = $col;
Hi and Happy New Year!
I use something like:
background: repeating-linear-gradient(120deg, #63C384, #63C384 1px, transparent 1px, transparent 2px);
Best regards!
Hello,
To have a checkbox with one selection at a time, first enable multiselect:true
$grid["multiselect"] = true; $grid["multiboxonly"] = true; // only allow selection using checkbox (not with row click)
Then you can try following:
$grid["beforeSelectRow"] = "function(rowid, e) { if ( jQuery('#list1').jqGrid('getGridParam','selarrrow') != rowid) jQuery('#list1').jqGrid('resetSelection'); return true; }";
OR
$grid["beforeSelectRow"] = "function(rowid, e) { return $(e.target).is('input[type=checkbox]'); }";
Finally, this $grid will be passed to set_options along with your other grid options.
$g->set_options($opt);
Now to pass the selected row to another page, e.g. on button click
<button onclick="pass_selected()">Pass</button> <script> function pass_selected() { var ids = jQuery('#list1').jqGrid('getGridParam','selarrrow').join(','); window.open('your-page.php?ids='+ids); } </script>
Let me know if you have any questions.