行編輯時點擊空白或切換行保存
阿新 • • 發佈:2018-11-05
eid fun jqgrid sele function sets 切換 空白 last
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=""; } } });
行編輯時點擊空白或切換行保存