for (var item_key in data) {//遍历json对象的每个key/value对,p为key
                    var reg = /^score\d+/gi;
                    for (var key in data[item_key]) {//遍历json对象的每个key/value对,p为key
                        if (key === "field") {
                            if (reg.test(data[item_key][key])) {
                                data[item_key].formatter = function (value, row, index) {
                                    return "<span title='' class='easyui-tooltip icon_cus_tip_move_file'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>" + value;
                                }
                            }
                            if (data[item_key][key] === "examName" || data[item_key][key] === "className") {
                                data[item_key].formatter = function (value, row, index) {
                                    return "<span title='" + value + "'  class='easyui-tooltip'>" + value + "</span>";
                                };
                            }
                            if (data[item_key][key] === "enable") {
                                data[item_key].formatter = function (value, row, index) {
                                    if (value) {
                                        return "<span class='icon_cus_checked'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>";
                                    }
                                    return "<span class='icon_cus_check'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>";
                                };
                                data[item_key].editor = {
                                    type: 'combobox',
                                    options: {
                                        panelHeight: 'auto',
                                        editable: false,
                                        data: [
                                            {
                                                value: "true",
                                                text: '出考'
                                            },
                                            {
                                                value: "false",
                                                text: '缺考'
                                            }
                                        ]
                                    }
                                };
                            }
                            if (data[item_key][key] === "remark") {
                                data[item_key].editor = {
                                    type: 'textbox',
                                    validType: 'length[0,200]'

                                }
                            }
                        }
                    }
                }

 

posted on 2018-09-27 09:15  網絡蛀蟲  阅读(231)  评论(0编辑  收藏  举报