📜  columndefs if condition - 无论代码示例

📅  最后修改于: 2022-03-11 14:56:20.883000             🧑  作者: Mango

代码示例1
"columnDefs" : [ {
                            "targets" : [ 3, 4, 5 ],
                            render : function(data, type, row, meta) {
                                if (meta.col == 4) {
                                    if (data == 1) {
                                        return 'Test1';
                                    } else if (data == 2) {
                                        return 'Test2';
                                    }
                                } else if (meta.col == 3 || meta.col == 5) {

                                    if (data == null || data == "") {
                                        return "";
                                    } else {
                                        return data;
                                    }
                                }
                            },
                        } ],


"columnDefs" : [ {
                            "className" : "dt-center",
                            "targets" : "0"
                        } ],