locked
Screen elements duplicated when screen is reloaded RRS feed

  • Question

  • If I load a screen, navigate to another browse screen and then returning to my original screen then all of the screen content is duplicated in a new <div> element with data-role="page". This doesn't happen if I navigate to another browse screen.

    The "data-url" for each div is starts with the screen name and then a hex number ("/BrowseFacilities/[fd6eb62b9]"). When the screen is reloaded a new div with the screen elements is created with a different hex number in the data-url.

    This causes problems when I try to locate elements by id because the id's are duplicated. Is this behavior by design?

    I've worked around the problem by adding an incrementing number to my id's on rendered custom controls but this seems like a kludge at best.

    Is there a better solution to this problem?

    Thanks

     

    Tuesday, January 13, 2015 4:19 PM

Answers

  • Hi Tom,

    Ah yes, that is the way it is, it is meant to have a max of 5 pages loaded in the DOM. I thought visually you were getting problems.

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    • Proposed as answer by joshbooker Wednesday, January 14, 2015 2:22 PM
    • Marked as answer by MelroseTom Thursday, January 15, 2015 12:54 PM
    Wednesday, January 14, 2015 12:38 PM

All replies

  • That is not normal behaviour. I have only ever seen this when custom render code is not correct either in the problem screen or the screen that you navigate to and back from.

    You will have to post your custom code for people to review.

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    Wednesday, January 14, 2015 8:38 AM
  • Hi Dave,

    I didn't think this was normal either. But it appears to be by design.

    I created a simple test project with two browse screens. After opening one screen and then navigating to a second, both screens are loaded into the DOM in separate <div> elements. Navigating back to the original screen creates a third <div> tag. After creating 5 <div> tags it maxes out and removes the oldest screen when a new screen is opened.

    Apparently to find elements from the currently active page you should search the children of the <div> tag with a class of "ui-page-active".

    I haven't seen this documented. But anyone using jquery should be aware of this behavior. 

    Tom

     

    Wednesday, January 14, 2015 12:16 PM
  • Hi Tom,

    Ah yes, that is the way it is, it is meant to have a max of 5 pages loaded in the DOM. I thought visually you were getting problems.

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    • Proposed as answer by joshbooker Wednesday, January 14, 2015 2:22 PM
    • Marked as answer by MelroseTom Thursday, January 15, 2015 12:54 PM
    Wednesday, January 14, 2015 12:38 PM