关于前端的json数据的转换,后端json数据的处理

var feeGrid;//相关费用信息

//处理json
//获取到json字符串
            data["ligergrid_feeJSON"] = JSON.stringify(feeGrid.getData());

//需要转换的数据 
function initGrit() {
            feeGrid = $("#ligergrid_fee").ligerGrid({
                url: '<%=path%>/ins/agent/getSubBusiness.do',
                method: 'get',
                columns: [
                    {
                        display: '是否购买', name: 'isBuy', width:150,
                        editor: {
                            type: 'select',
                            data: isOrNoJSON,
                            valueField: 'key',
                            textField: 'value'
                        },
                        valueField: 'isBuy',
                        textField: 'isBuyNm',
                        render: function (item) {
                            return item.isBuyNm;
                        }
                    },
                    {
                        display: '险种名称', name: 'insName', minWidth: 200,
                        valueField: 'insName',
                        textField: 'insName'
                    },
                    {
                        display: '保额', name: 'defaultAmt', width:300,
                        editor: {
                            type: 'select',
                            data: 'insAmts',
                            valueField: 'insSubAmt',
                            textField: 'insSubAmt'
                        },
                        valueField: 'defaultAmt',
                        textField: 'defaultAmt',
                        render: function (item) {
                            return item.defaultAmt;
                        }
                    }
                ],
                onBeforeSubmitEdit: function (e) {

                },
                onBeforeEdit: function (e) {
                    var colName=e.column.columnname;
                    var amts=e.record.insAmts;
                    if(colName == "defaultAmt" && amts){
                        e.column.editor={
                            type: 'select',
                            data: amts,
                            valueField: 'insSubAmt',
                            textField: 'insSubAmt',
                            readonly:false
                        }
                    }else{
                        if(colName == "defaultAmt"){
                            e.column.editor.readonly=true;
                        }
                    }
                },
                onAfterEdit:function(e){
                    var colName=e.column.columnname;
                    var amts=e.record.insAmts;
                    if(colName == "defaultAmt" && !amts){
                        e.column.editor.readonly=true;
                    }else{
                        e.column.editor.readonly=false;
                    }
                },
                usePager: false,
                root: 'rows',
                record: 'total',
                hideLoadButton: true,
                width: '100%',
                height: 300,
                heightDiff: -2,
                enabledEdit: true,
                isScroll: false,
                checkbox: false,
                rownumbers: true,
                allowUnSelectRow: true,
                alternatingRow: false
            });
        }

后端对传过来的json 行进处理

 

//==========子险种信息开始==================
        //获取到json字符串
        String ligergridfeeJSON = request.getParameter("ligergrid_feeJSON");
        List rlPsnList = new ArrayList();
        if (null != ligergridfeeJSON){
            rlPsnList = JSON.parseArray(ligergridfeeJSON, InsSubPlyDetailVO.class);
        }
//==========子险种信息结束==================

 

你可能感兴趣的:(关于前端的json数据的转换,后端json数据的处理)