* Convert the index type * * @param dt DataTable to work on * @param idx Index to transform * @param dir Transform direction * @returns Converted number(s)
(dt, idx, dir)
| 17442 | * @returns Converted number(s) |
| 17443 | */ |
| 17444 | function transpose(dt, idx, dir) { |
| 17445 | var order = dt.colReorder.order() |
| 17446 | var columns = dt.settings()[0].aoColumns |
| 17447 | if (dir === "toCurrent" || dir === "fromOriginal") { |
| 17448 | // Given an original index, want the current |
| 17449 | return !Array.isArray(idx) |
| 17450 | ? order.indexOf(idx) |
| 17451 | : idx.map(function (index) { |
| 17452 | return order.indexOf(index) |
| 17453 | }) |
| 17454 | } |
| 17455 | // Given a current index, want the original |
| 17456 | return !Array.isArray(idx) |
| 17457 | ? columns[idx]._crOriginalIdx |
| 17458 | : idx.map(function (index) { |
| 17459 | return columns[index]._crOriginalIdx |
| 17460 | }) |
| 17461 | } |
| 17462 | /** |
| 17463 | * Validate that a requested move is okay. This includes bound checking |
| 17464 | * and that it won't split colspan'ed cells. |
no test coverage detected