• easyui datagrid 动态生成列


     for (var item_key in data) {//遍历json对象的每个key/value对,p为key
                        var reg = /^scored+/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]'
    
                                    }
                                }
                            }
                        }
                    }
  • 相关阅读:
    Win10使用VMware虚拟机安装ubuntu
    算法资源清单
    JAVA Synchronized (三) volatile 与 synchronized 的比较
    JAVA Synchronized (二)
    Java多线程:线程状态以及wait(), notify(), notifyAll()
    Java中断机制
    Java throw与throws
    Java(Android)线程池
    JAVA interrupte中断线程的真正用途
    Java 守护线程
  • 原文地址:https://www.cnblogs.com/armyant/p/9711314.html
Copyright © 2020-2023  润新知