行编辑时点击空白或切换行保存

 var lastsel; //在顶部定义



onSelectRow:function(id){
if(id && id!==lastsel){ 
$(tableid).jqGrid('saveRow',lastsel);
lastsel=id; 
} 
$(tableid).editRow(id, true);

BkcTool.clearEdit(tableid,lastsel)
}//加上grid代码处。


 $('html').bind('click', function(e) { //用于点击其他地方保存正在编辑状态下的行
        if ( lastsel != "" ) { 
            if($(e.target).closest(tableid).length == 0) {   
           jQuery(tableid).jqGrid('saveRow', lastsel); 
            jQuery(tableid).resetSelection(); 
            lastsel=""; 
            } 
        } 
    });

  

posted @ 2018-11-05 15:08  我是一只小蜂农  阅读(364)  评论(0编辑  收藏  举报