In this demo of jqGrid, when you click on the "Edit Selected Row" button:
it brings up an edit form.
Is there any way to double click on a row in the grid to bring up this same edit form?
In this demo of jqGrid, when you click on the "Edit Selected Row" button:
it brings up an edit form.
Is there any way to double click on a row in the grid to bring up this same edit form?
It can be very simple implemented as
ondblClickRow: function(rowid) {
jQuery(this).jqGrid('editGridRow', rowid);
}
you can also use any additional properties of editGridRow described in the documentation. For example
ondblClickRow: function(rowid) {
jQuery(this).jqGrid('editGridRow', rowid,
{recreateForm:true,closeAfterEdit:true,
closeOnEscape:true,reloadAfterSubmit:false});
}
ondblClickRow
performing the cell edit. How would one cause the even of selecting a different cell to cause the save of the cell under edit? –
Enclasp onSelectRow
, onCellSelect
or beforeSelectRow
event handler where you compare the id of the last edited row with the id of the current clicked row. If the ids are different you can call saveRow to save last edited row. –
Forbidden simple way
ondblClickRow : function(rowid) {
$("#edit_mygridId").trigger("click");
}
check answers of similar questions:
jqGrid Cell Editing - Double Click to Edit?
jqGrid: replace single click with double click to enter cell edit mode
Here a little more complex ondblClickRow, from my codes, this get the data from form and altered a varible before submit, also adding a variable before post.
ondblClickRow: function(rowid) {
jQuery(this).jqGrid('editGridRow', rowid,
{
recreateForm:true,
closeAfterEdit:true,
closeOnEscape:true,
reloadAfterSubmit:true,
url:"proc/jqgridUsers.php",
editCaption : "Edit User",
bottominfo : "Fields (*) are requeired ",
height:330,
width:350,
beforeSubmit:function(postdata, formid){
var dataString = $("#formid").serialize();
var ord1 = document.getElementById('ord1').value;
var ord2 = document.getElementById('ord2').value;
var ordx = hex_sha1(hex_md5(document.getElementById('ord1').value));
postdata.ord1 = ordx;
postdata.ord2 = "";
var boolcontrol = false;
var message="";
if (ord1!=ord2) {
return [boolcontrol,"Password are not the same!!"];
} else {
boolcontrol = true;
}
return [boolcontrol,message]; // no error
}
});
}
© 2022 - 2024 — McMap. All rights reserved.