(column, table_name = "content_table")
| 284 | } |
| 285 | |
| 286 | function sortTable(column, table_name = "content_table") { |
| 287 | // console.log("COLUMN: " + column); |
| 288 | |
| 289 | if ((column == COLUMN_TO_SORT && table_name == "content_table") || (column == INACTIVE_COLUMN_TO_SORT && table_name == "inactive_content_table")) { |
| 290 | return; |
| 291 | } |
| 292 | |
| 293 | |
| 294 | var table = document.getElementById(table_name); |
| 295 | var tableHead = table.getElementsByTagName("TR")[0]; |
| 296 | var tableItems = tableHead.getElementsByTagName("TD"); |
| 297 | |
| 298 | var sortObj = new Object(); |
| 299 | var x, xValue; |
| 300 | var tableHeader |
| 301 | var sortByString = false |
| 302 | |
| 303 | if (column > 0 && COLUMN_TO_SORT > 0 && table_name == "content_table") { |
| 304 | tableItems[COLUMN_TO_SORT].className = "pointer"; |
| 305 | tableItems[column].className = "sortThis"; |
| 306 | } else if (column > 0 && INACTIVE_COLUMN_TO_SORT > 0 && table_name == "inactive_content_table") { |
| 307 | tableItems[INACTIVE_COLUMN_TO_SORT].className = "pointer"; |
| 308 | tableItems[column].className = "sortThis"; |
| 309 | } |
| 310 | |
| 311 | if (table_name == "content_table") { |
| 312 | COLUMN_TO_SORT = column; |
| 313 | } else if (table_name == "inactive_content_table") { |
| 314 | INACTIVE_COLUMN_TO_SORT = column; |
| 315 | } |
| 316 | |
| 317 | |
| 318 | |
| 319 | var rows = (table as HTMLTableElement).rows; |
| 320 | |
| 321 | if (rows[1] != undefined) { |
| 322 | tableHeader = rows[0] |
| 323 | |
| 324 | x = rows[1].getElementsByTagName("TD")[column]; |
| 325 | |
| 326 | for (i = 1; i < rows.length; i++) { |
| 327 | |
| 328 | x = rows[i].getElementsByTagName("TD")[column]; |
| 329 | |
| 330 | switch (x.childNodes[0].tagName.toLowerCase()) { |
| 331 | case "input": |
| 332 | xValue = x.getElementsByTagName("INPUT")[0].value.toLowerCase(); |
| 333 | break; |
| 334 | |
| 335 | case "p": |
| 336 | xValue = x.getElementsByTagName("P")[0].innerText.toLowerCase(); |
| 337 | break; |
| 338 | |
| 339 | default: console.log(x.childNodes[0].tagName); |
| 340 | } |
| 341 | |
| 342 | if (xValue == "") { |
| 343 |
no test coverage detected