简体   繁体   中英

JQgrid inline edit second time previously selected row not edit?

I am used onSelectRow event for editing selected row.

Initially this event work fine but after editing row, if

  1. Refresh grid and
  2. Once again try to select previously selected row then it not get editable.

My onSelectRow is:

onSelectRow: function(id)
{
  if(id && id!==lastsel)
  {
    jQuery('#My_grid').jqGrid('restoreRow',lastsel);
    jQuery('#My_grid').jqGrid('editRow',id,true);
    lastsel=id;
  }
}

so please tell me how to fix this problem.

Thank You

Can you please try this:

if ($("tr#"+id).attr("editable") == "1") {  // Checking state of grid row
 jQuery('#My_grid').jqGrid('restoreRow',id); 
}
else
{
jQuery('#My_grid').jqGrid('editRow',id,true);
}

Hope this helps..

hey Avinash I solved this issue I am just change in my onSelectRow event

onSelectRow: function(id)
{
  if(id)
  {
    jQuery('#My_grid').jqGrid('restoreRow',lastsel);
    jQuery('#My_grid').jqGrid('editRow',id,true);
    lastsel=id;
  }
}

Edit in if condition used if(id) instead of if(id && id!==lastsel) .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM