简体   繁体   English

JQgrid内联编辑第二次以前选中的行不能编辑?

[英]JQgrid inline edit second time previously selected row not edit?

I am used onSelectRow event for editing selected row. 我用onSelectRow事件来编辑所选行。

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是:

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 嘿Avinash我解决了这个问题我只是改变了我的onSelectRow事件

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) . 编辑if if条件使用if(id)而不是if(id && id!==lastsel)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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