Jump to content
  • 0

When DataPageReady is not really ready


JohnM

Question

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...