Code Duplication    Length = 50-50 lines in 2 locations

add/table_helper.js 1 location

@@ 100-149 (lines=50) @@
97
                };
98
            },
99
            Draw: {
100
                Section: function(tableContainer, dt, tSection){
101
                    var section = tSection === "tfoot" ? "tfoot" : "tbody";
102
                    var tSec = document.getElementById(tableContainer)
103
                                .getElementsByTagName(section)[0];
104
                    Clear(tSec, th_instance.IePrior(9));
105
                    for(var i = 0; i < dt.length; i++){
106
                        var row = dt[i];
107
                        var tRow = document.createElement("tr");
108
                        Row(row, tRow);
109
                        tSec.appendChild(tRow);
110
                        if(section === "tfoot"){
111
                            th_instance.ProcessPaginationLinks(tSec);
112
                        }
113
                    }
114
                    function Clear(tSection, iePrior9){
115
                        if(iePrior9){
116
                            if(tSection.firstChild){
117
                                while(tSection.firstChild){
118
                                    tSection.removeChild(tSection.firstChild);
119
                                }
120
                            }
121
                        }else{
122
                            tSection.innerHTML = "";
123
                        }
124
                    }
125
                    function Row(row, tRow){
126
                        for(var cell in row){
127
                            var tCell = document.createElement("td");
128
                            if(typeof row[cell] === "string" || 
129
                               typeof row[cell] === "number"
130
                            ){
131
                                tCell.innerHTML = row[cell];
132
                            }else if(typeof row[cell] === "object"){
133
                                RowCellFromObject(row, cell, tCell);
134
                            }
135
                            tRow.appendChild(tCell);
136
                        }
137
                    }
138
                    function RowCellFromObject(row, cell, tCell){
139
                        for(var attr in row[cell]){
140
                            if(typeof row[cell][attr] === "string"){
141
                                tCell.innerHTML = row[cell][attr];
142
                            }else if(typeof row[cell][attr] === "object"){
143
                                for(var v in row[cell][attr]){
144
                                    tCell.setAttribute(v, row[cell][attr][v]);
145
                                }
146
                            }
147
                        }
148
                    }
149
                },
150
                Run: function(tableContainer, d, instance){
151
                    this.Section(tableContainer, d.body);
152
                    this.Section(tableContainer, d.footer, "tfoot");

add/table.js 1 location

@@ 97-146 (lines=50) @@
94
        };
95
    },
96
    Draw: {
97
        Section: function(tableContainer, dt, tSection){
98
            var section = tSection === "tfoot" ? "tfoot" : "tbody";
99
            var tSec = document.getElementById(tableContainer)
100
                        .getElementsByTagName(section)[0];
101
            Clear(tSec, TableHelper.IePrior(9));
102
            for(var i = 0; i < dt.length; i++){
103
                var row = dt[i];
104
                var tRow = document.createElement("tr");
105
                Row(row, tRow);
106
                tSec.appendChild(tRow);
107
                if(section === "tfoot"){
108
                    TableHelper.ProcessPaginationLinks(tSec);
109
                }
110
            }
111
            function Clear(tSection, iePrior9){
112
                if(iePrior9){
113
                    if(tSection.firstChild){
114
                        while(tSection.firstChild){
115
                            tSection.removeChild(tSection.firstChild);
116
                        }
117
                    }
118
                }else{
119
                    tSection.innerHTML = "";
120
                }
121
            }
122
            function Row(row, tRow){
123
                for(var cell in row){
124
                    var tCell = document.createElement("td");
125
                    if(typeof row[cell] === "string" || 
126
                       typeof row[cell] === "number"
127
                    ){
128
                        tCell.innerHTML = row[cell];
129
                    }else if(typeof row[cell] === "object"){
130
                        RowCellFromObject(row, cell, tCell);
131
                    }
132
                    tRow.appendChild(tCell);
133
                }
134
            }
135
            function RowCellFromObject(row, cell, tCell){
136
                for(var attr in row[cell]){
137
                    if(typeof row[cell][attr] === "string"){
138
                        tCell.innerHTML = row[cell][attr];
139
                    }else if(typeof row[cell][attr] === "object"){
140
                        for(var v in row[cell][attr]){
141
                            tCell.setAttribute(v, row[cell][attr][v]);
142
                        }
143
                    }
144
                }
145
            }
146
        },
147
        Run: function(tableContainer, d, instance){
148
            this.Section(tableContainer, d.body);
149
            this.Section(tableContainer, d.footer, "tfoot");