(settings, column, vis)
| 7931 | } |
| 7932 | |
| 7933 | var __setColumnVis = function (settings, column, vis) { |
| 7934 | var cols = settings.aoColumns, |
| 7935 | col = cols[column], |
| 7936 | data = settings.aoData, |
| 7937 | cells, |
| 7938 | i, |
| 7939 | ien, |
| 7940 | tr |
| 7941 | |
| 7942 | // Get |
| 7943 | if (vis === undefined) { |
| 7944 | return col.bVisible |
| 7945 | } |
| 7946 | |
| 7947 | // Set |
| 7948 | // No change |
| 7949 | if (col.bVisible === vis) { |
| 7950 | return false |
| 7951 | } |
| 7952 | |
| 7953 | if (vis) { |
| 7954 | // Insert column |
| 7955 | // Need to decide if we should use appendChild or insertBefore |
| 7956 | var insertBefore = _pluck(cols, "bVisible").indexOf(true, column + 1) |
| 7957 | |
| 7958 | for (i = 0, ien = data.length; i < ien; i++) { |
| 7959 | if (data[i]) { |
| 7960 | tr = data[i].nTr |
| 7961 | cells = data[i].anCells |
| 7962 | |
| 7963 | if (tr) { |
| 7964 | // insertBefore can act like appendChild if 2nd arg is null |
| 7965 | tr.insertBefore(cells[column], cells[insertBefore] || null) |
| 7966 | } |
| 7967 | } |
| 7968 | } |
| 7969 | } else { |
| 7970 | // Remove column |
| 7971 | $(_pluck(settings.aoData, "anCells", column)).detach() |
| 7972 | } |
| 7973 | |
| 7974 | // Common actions |
| 7975 | col.bVisible = vis |
| 7976 | |
| 7977 | _colGroup(settings) |
| 7978 | |
| 7979 | return true |
| 7980 | } |
| 7981 | |
| 7982 | _api_register("columns()", function (selector, opts) { |
| 7983 | // argument shifting |
no test coverage detected