In a tabular report, I want to set the .selectedIndex of a dropdown in the inline insert row to match that of the associated dropdown in the search area.
I am using JavaScript inside the Header of the DataPage Elements on Search and Report Wizard - Configure Results Page Fields.
This script does not work.
document.addEventListener('DataPageReady', function (event) {
document.getElementById("InlineAddFolder_ID").selectedIndex = document.getElementById("Value4_1").selectedIndex;
});
I can see that the .selectedIndex gets set, but it then gets immediately returned to the default.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
JohnM
In a tabular report, I want to set the .selectedIndex of a dropdown in the inline insert row to match that of the associated dropdown in the search area.
I am using JavaScript inside the Header of the DataPage Elements on Search and Report Wizard - Configure Results Page Fields.
This script does not work.
document.addEventListener('DataPageReady', function (event) { document.getElementById("InlineAddFolder_ID").selectedIndex = document.getElementById("Value4_1").selectedIndex; });
I can see that the .selectedIndex gets set, but it then gets immediately returned to the default.
But this script does work.
document.addEventListener('DataPageReady', function (event) { setTimeout(function(){ document.getElementById("InlineAddFolder_ID").selectedIndex = document.getElementById("Value4_1").selectedIndex; }, 500) });
Why must I add the delay?
Is the DataPage not really Ready when DataPageReady fires?
Is there a better way to handle this? Should the script be inserted somewhere else?
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.