zoukankan      html  css  js  c++  java
  • datagrid行内编辑

    编辑属性 :editor: { type: 'text'}
    $('#listShow').datagrid({            
            height : 478,
            pagesize : 20,
            pageList : [20,30,40,50],
            title : '查询结果',
            striped : true,
            singleSelect: true,
            rownumbers: true,
            columns : [[ {field:'id',checkbox:true}, 
                            {"align":"center","field":"SHORTSTR5",formatter : function(value, row, index) {    
                    return "<a href='#' onclick=openCaseInfo('"+value+"')>"+value+"</a>";
                                            },"title":"案件号","width":"100"},
                            {"align":"center","field":"SHORTSTR13","title":"结案时间","width":"100"},
                            {"align":"center","field":"SHORTSTR14","title":"回访结果","width":"100",editor: { type: 'text'}},
                            {"align":"center","field":"SHORTSTR15","title":"是否安抚","width":"100",editor: { type: 'text'}},
                            {"align":"center","field":"SHORTSTR16","title":"备注","width":"100",editor: { type: 'text'}}, 
                            {"align":"center","field":"SHORTSTR17","title":"整改措施","width":"100",editor: { type: 'text'}},
                            {"field": "option", "title" : "操作", "width" : "100", "align" : "center",
                                formatter:function(value,row,index){
                                    var btn="<a class='link-button' href='javascript:editOne("+index+")'>编辑 </a>";
                                    btn += "  <a class='link-button' href='javascript:saveOne("+index+")'>保存 </a> ";
                                    btn += "  <a class='link-button' href='javascript:endOne("+index+")'>结案 </a> ";
                                    return btn; 
    
                                    }
                              }
                            ]],
                pagination: false
        });
    //编辑选中行内的最大服务数
    function editOne(index){
        var row = $('#listShow').datagrid('getSelected');
        var endTime = row.SHORTSTR13;
        if(endTime !=null && endTime != ""){
            alert("该案件已结案!不能编辑!");
            return;
        }
        $('#listShow').datagrid('beginEdit', index);
    };
    
    //保存编辑行
    function saveOne(index){
        var row = $('#listShow').datagrid('getSelected');
        $('#listShow').datagrid('endEdit', index);
        var params = {
            caseNo :row.SHORTSTR5,
            callbackResult : row.SHORTSTR14,
            isAppease : row.SHORTSTR15,
            remark : row.SHORTSTR16,
            correctionMethod : row.SHORTSTR17
        };
        $.ajax({   
            url: "*",   
            data: params,
            type: 'POST',  
            dataType: 'json',   
            timeout: 5000,  
            async: false,   
            error: function(){   
                alert('保存失败!');
                return false;
            },   
            success: function(json){     
                alert('保存成功!');
            }
           }); 
    };
    //结案
    function endOne(index){
        var row = $('#listShow').datagrid('getSelected');
        var endTime = row.SHORTSTR13;
        if(endTime !=null && endTime != ""){
            alert("该案件已结案!");
            return;
        }
        var params = {
                caseNo :row.SHORTSTR5,
                policyNo : row.SHORTSTR7        
            };
        $.ajax({   
            url: "*",   
            data: params,
            type: 'POST',  
            dataType: 'json',   
            timeout: 5000,  
            async: false,   
            error: function(){   
                alert('结案失败!');
                return false;
            },   
            success: function(json){     
                alert('结案成功!');
                $('#listShow').datagrid('updateRow', {index:index, 
                    row:{SHORTSTR13: json.endTime}
                    }); 
                }
           }); 
    };

    效果:

  • 相关阅读:
    如何使用用Postman工具做接口自动化测试 -入门到实战篇
    python 自动化测试框架unittest与pytest的区别
    Postman接口工具如何测试WebService接口
    Python+requests+unittest+excel实现接口自动化测试框架
    速看!!python WEB接口自动化测试之requests库详解
    大佬教你美团接口自动化测试实战-0基础入门到精通
    dotnet OpenXML 转换 PathFillModeValues 为颜色特效
    dotnet 构建还原失败 NuGet.targets 错误可能原因
    WPF 简单实现一个支持删除自身的应用
    dotnet C# 反射扫描程序集所有类型会不会触发类型静态构造函数
  • 原文地址:https://www.cnblogs.com/justBobo/p/10837068.html
Copyright © 2011-2022 走看看