MCPcopy Create free account
hub / github.com/OpenIntroStat/ims / onlyKeepSelectableCells

Function onlyKeepSelectableCells

libs/datatables-binding-0.18/datatables.js:1178–1197  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1176 }
1177 // Change selected3's value based on selectable3, then refresh the cell state
1178 var onlyKeepSelectableCells = function() {
1179 if (selDisable) { // users can't select; useful when only want backend select
1180 selected3 = [];
1181 return;
1182 }
1183 if (selectable3.length === 0) return;
1184 var nonselectable = selectable3[0][0] <= 0;
1185 var out = [];
1186 if (nonselectable) {
1187 selected3.map(function(ij) {
1188 // should make selectable3 positive
1189 if (findIndex([-ij[0], -ij[1]], selectable3) === -1) { out.push(ij); }
1190 });
1191 } else {
1192 selected3.map(function(ij) {
1193 if (findIndex(ij, selectable3) > -1) { out.push(ij); }
1194 });
1195 }
1196 selected3 = out;
1197 }
1198 // Change selected3's value based on selectable3, then
1199 // refresh the cell selection state according to values in selected3
1200 var selectCells = function(ignoreSelectable) {

Callers 1

selectCellsFunction · 0.85

Calls 1

findIndexFunction · 0.85

Tested by

no test coverage detected