0
votes

I have a Single Page Application that has two pages - the first page contains a Data View view control (I used the wizard to create the pages - I did not create any custom controls as the entire application only contains 4 pages!), the second page then displays the document selected in the Data View control. This works perfectly! My problem is that the documents that are displayed in the Data View Control are not being refreshed - I need to do a manual refresh for them to show up. Not a problem I though, just do an automatic refresh every 5 seconds (there are only going to be about 20 users using the application):

<meta http-equiv="refresh" content="5; URL="></meta>

this refreshes the page perfectly - if a user is on the second page s/he gets bumped back to the page with the Data View control (i.e. Page 1) and does not stay on the open document (ie page 2).

How can I get the Data View control to refresh periodically without being bumped back to the Data View control?

Thanking you in advance ursus

1

1 Answers

1
votes

I don't think you really want to refresh the view every n seconds as that has the possibility of becoming a huge performance issue, plus the cause for weirdness as you pointed out. There are 2 ways to approach this:

  • In the Application Page properties, set resetContent to true
  • Create a onAfterTransitionIn event to do an XSP.partialRefreshGet on the data view or it's container. This way when someone lands on the view it'll refresh it's contents. Below is an example:

    var widget = dijit.byId("#appPageName");
    dojo.connect(widget, "onAfterTransitionIn", function(moveTo, dir, transition, context, method){
        console.log("onAfterTransitionIn args=",arguments);
        var appPageChildren = dojo.query("[id='" + appPageName + "']").children()[0];
        var contentId = appPageChildren.id;
        console.log("contentId=",contentId);
        setTimeout(function() {
            XSP.partialRefreshGet(contentId, {});
        },200);
    });