MCPcopy Create free account
hub / github.com/breck7/scroll / transpose

Function transpose

external/.datatables.js:17444–17461  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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.

Callers 2

setOrderFunction · 0.70
.datatables.jsFile · 0.70

Calls 2

indexOfMethod · 0.80
mapMethod · 0.80

Tested by

no test coverage detected