I'm facing a challenge with the feature that involves hiding a row based on a selection:
<tr data-param-name="nodeGroup">
within web api, Program.cs:
app.UseSwaggerUI(options => {
options.InjectJavascript("/custom.js");
});
The custom javascript file (custom.js):
var providerSelect = null;
var nodeGroup = null;
document.onreadystatechange = () => {
if (document.readyState === 'complete') {
// document is ready
providerSelect = document.querySelector("[data-param-name='provider'] select");
nodeGroup = document.querySelector("[data-param-name='nodeGroup']");
if (providerSelect) {
providerSelect.addEventListener("change", function () {
var text = providerSelect.options[providerSelect.selectedIndex].text;
if (text == "EcoPlatform") {
nodeGroup.setAttribute("visibility", "visible");
}
else {
nodeGroup.setAttribute("visibility", "collapse");
}
});
}
}
};
The aforementioned approach does not appear to be functioning as intended.
- The page does not display correctly when the readystate is 'complete'
- The providerSelect element is not filled prior to clicking the drop-down arrow on the "accordion". The <noscript> tag is replaced upon click.