* Setup for ColReorder API operations * * @param dt DataTable(s) being operated on - might have multiple tables!
(api)
| 17221 | * @param dt DataTable(s) being operated on - might have multiple tables! |
| 17222 | */ |
| 17223 | function init(api) { |
| 17224 | // Assign the original column index to a parameter that we can lookup. |
| 17225 | // On the first pass (i.e. when the parameter hasn't yet been set), the |
| 17226 | // index order will be the original order, so this is quite a simple |
| 17227 | // assignment. |
| 17228 | api.columns().iterator("column", function (s, idx) { |
| 17229 | var columns = s.aoColumns |
| 17230 | if (columns[idx]._crOriginalIdx === undefined) { |
| 17231 | columns[idx]._crOriginalIdx = idx |
| 17232 | } |
| 17233 | }) |
| 17234 | } |
| 17235 | /** |
| 17236 | * Switch the key value pairing of an index array to be value key (i.e. the old value is now the |
| 17237 | * key). For example consider [ 2, 0, 1 ] this would be returned as [ 1, 2, 0 ]. |
no outgoing calls
no test coverage detected