jqgrid點空餘地方保存編輯

jqgrid雙擊行,進入編輯狀態,在不按回車的情況下保存提交內容

var lastsel;
    $('html').bind('click', function(e) { //用於點擊其他地方保存正在編輯狀態下的行
        if ( lastsel != "" ) { //if a row is selected for edit
            if($(e.target).closest('#EM_Report').length == 0) { //and the click is outside of the grid //save the row being edited and unselect the row 
            alert(lastsel);jQuery('#EM_Report').jqGrid('saveRow', lastsel);
            jQuery('#EM_Report').resetSelection();
            lastsel="";
            }
        }
    });

來自http://stackoverflow.com/questions/7311780/jqgrid-sava-row-data-to-db-on-click-out-of-grid方法

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章