首页 > 其他 > 详细

easyui datagrid 单元格编辑保存

时间:2015-01-26 18:45:59      阅读:599      评论:0      收藏:0      [点我收藏+]

技术分享

要求分数和排序两列能编辑

    //查询该试卷题型的试题
    $(‘#allList1‘).datagrid({    
        url:app.approot+"paperRes/getPaperQuestionList/"+ptyid,
        handler:function(){ //接受改变的值
        $(‘#allList1‘).datagrid(‘acceptChanges‘);
        },  
        onBeforeEdit: function (rowIndex,rowData) {
         $("#selQuestionId").val(rowData.questionId);
        },
        onClickCell: onClickCell,
        onAfterEdit:function(rowIndex, rowData, changes){  // 第三个参数是改变的值
         // alert(changes.scoreItem);
          if(changes.questionNo!=undefined&&changes.questionNo!=‘undefined‘){
               $.post(app.approot+‘paperRes/updateQuestionNo/‘+rowData.paperId+
                       ‘/‘+rowData.questionId+‘/‘+changes.questionNo,function(result){
                      if(result.msgid=="1"){  
                         $(‘#allList1‘).datagrid(‘reload‘);
                      }else{
                          $.messager.alert("操作提示",result.msg,"info"); 
                      }
                     
                  },"json");  
          }
          if(changes.scoreItem!=undefined&&changes.scoreItem!=‘undefined‘){
               $.post(app.approot+‘paperRes/updateQuestionScoreItem/‘+rowData.paperId+
                       ‘/‘+rowData.questionId+‘/‘+changes.scoreItem,function(result){
                      if(result.msgid=="1"){
                          $(‘#allList1‘).datagrid(‘refreshRow‘, rowIndex);  
                      }else{
                          $.messager.alert("操作提示",result.msg,"info"); 
                          $(‘#allList1‘).datagrid(‘reload‘);
                      }
                     
                  },"json");  
          }
       
        }

        });

 

easyui datagrid 单元格编辑保存

原文:http://www.cnblogs.com/dingding0505/p/4250846.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!