//追加,更新 function operate(type){ var rows = grid.getSelectedRows(); if ((rows == null || rows.length!=1) && type != 1 ) { $.ligerDialog.warn("请选择一条记录!","提示"); return; };{$popText2} // 追加 if(type==1){ // 清空Form $("#saveForm")[0].reset() $("input[type='radio']").attr("checked",false); $("input[type='checkbox']").attr("checked",false); $("input[type='radio']").each(function () { var this_id = $(this).attr("name"); $("input[name='"+this_id+"']").get(0).checked=true; }); // 隐藏及显示 $("#grid").hide(); $("#grid_search").hide(); $("#grid_save").show(); // 更新 }else{ var id = rows[0].{$PRIMARY_KEY}; // 后台取得内容填充显示 $.ajax({ type : 'get', url : "detail", data : {id:id}, cache : false, dataType : 'json', success : function(data) { // 加载内容 detail=data.ret; loadData(detail); // 隐藏及显示 $("#grid").hide(); $("#grid_search").hide(); $("#grid_save").show(); } }); {$popText4} } }