Skip to content

Filtering to available units

This guide provides instructions on how to filter out unavailable units from being displayed in the list of suggested units.

Calcumate allows you to filter out specific units so that they do not appear in the results. This can be useful for managing inventory and ensuring only available units are displayed to users.

To disable specific units, use the following JavaScript code:

window.dispatchEvent(new CustomEvent("calcumateLoad", {
detail: [<Units ID>, <Units ID>],
}));
  • Replace <Units ID> with the actual IDs of the units you want to disable.
  • You can list multiple unit IDs separated by commas within the square brackets.

To enable all units again, pass an empty array in the detail:

window.dispatchEvent(new CustomEvent("calcumateLoad", {
detail: [],
}));

To see a list of all available units, use the following command:

window.listUnits

To see a list of all currently disabled units, use the following command:

window.disableUnits
  1. Here is an example of how to disable two units with IDs 123 and 456:
window.dispatchEvent(new CustomEvent("calcumateLoad", {
detail: [123, 456],
}));

To enable all units again:

window.dispatchEvent(new CustomEvent("calcumateLoad", {
detail: [],
}));