1

I'm using SP2013 and I am trying to refresh one of many list web parts on a page with the Manual Refresh button displayed for each list.

The current display view has four lists associated with it each with a Manual Refresh button displayed for each.

I am trying to refresh via JavaScript. Async Update is enabled as is Show Manual Refresh Button in the respective web parts.

My code works as long as the List Settings>Advanced Settings> Dialogs is set to NO. A full page view.

So, for example, document.querySelectorAll("#ManualRefresh") returns a usable object. So, the code to refresh for a specific web part looks as follows:

var myelement-document.querySelector("#WebPartWPQ6");
var refresh=myelement.querySelectorAll("#ManualRefresh");
myrefresh[0[.click();  

When in the console I run document.querySelectorAll("#ManualRefresh") I am returned an object which in my case has 4 elements since I have four ManualRefreash buttons on the page.

However, when Dialogs is set to Yes the document.querySelectorAll("#ManualRefresh") returns a Null object.

Seems I need to use something other than "document" in document.querySelectorAll statement to grab the DOM element from the dialog vs. the document. That is my assumption anyhow.

How do I access the dialog object vs. the document object and then use the queryselector as above modified to use a dialog vs. a page? If my nomenclature is wrong by all means correct me.

Thanks.

1 Answer 1

0

The dialog object shoulg be iframe element in html, and you could get the element in iframe with this script:

document.getElementById(iframeId).contentWindow.document

Reference:

https://stackoverflow.com/questions/2868032/javascript-how-to-change-elements-content-inside-a-page-when-using-iframes-us

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.