Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active October 8, 2020 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/1d1a9ee75874fac77355fe87695902c7 to your computer and use it in GitHub Desktop.
Save bjoerntx/1d1a9ee75874fac77355fe87695902c7 to your computer and use it in GitHub Desktop.
// check cell status on input position changes
TXTextControl.addEventListener("inputPositionChanged", function () {
TXTextControl.tables.getItem(function (table) { // table at input pos?
if (table === null) { // return if no table available
EnableFormElements(
["operator", "compareValue", "trueColor", "falseColor", "enableCondition"],
false); return;
}
// enable form elements
EnableFormElements(
["operator", "compareValue", "trueColor", "falseColor", "enableCondition"],
true);
table.cells.getItemAtInputPosition(function (cell) { // cell at input pos
if (cell == null) { // return if more cells are selected
enableCellConditions(false);
document.getElementById("enableCondition").setAttribute(
"disabled", "disabled");
return;
}
// check the cell name that stores the conditions
cell.getName(function (cellName) {
if (cellName === "") { enableCellConditions(false); return; }
updateSettings(JSON.parse(cellName));
});
});
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment