码迷,mamicode.com
首页 > 其他好文 > 详细

easyui datagrid 单元格编辑保存

时间:2015-01-26 18:46:54      阅读:461      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!