开发者

Trigger a blur event on an editable row

Hii,

I am using jqGrid for displaying data.I have a problem with inline editing.My customer wants to save a row on blur event.BTW I am using row editing.The jqGrid requires explicitly pressing enter to save a particular row.Is there a specific way to trigger a blur event on a row? I tried different options like

$("tr#"+id,"table tbody").live('blur',function(e){

     $("#gridId").saveRow(id);

});

as well as

$(".editable").live('blur',function(e){

         $("#gridId").saveRow(rowId);

  });

But none of them worked.Both are getting triggered when I move out 开发者_开发百科of the particular cell. Is there a way to save the row once the user moves out of editing??


Not sure if this works, but you can try to use onSelectRow event.

onSelectRow: function(rowid,status)
{
  if(!status)//deselected
  {
     if($("tr#" + rowid).attr("editable") == 1) //editable=1 means row in edit mode
        $("#gridId").saveRow(rowid);
  }
}


You can trigger the enter key like so...

var event = jQuery.event('keydown');
event.which = 13; 
$('tr input').trigger(event);

It may require some modifications depending on how jqGrid handles the keypress.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜