locked
LightSwitch HTML - Hiding Sections to display later, but no alignment RRS feed

  • Question

  • I am developing an app in LightSwitch 2012 v2 with HTML client. My form has several sections, each of which is preceded by a boolean.  If the answer to 2A is NO, then you can skip the rest of section 2.  Likewise for 3A & 4A.  

    I would like to initially display the form with the sub-sections all hidden.  Then if the user clicks 2A = yes, the rest of Section 2 appears. 

    The problem is, when the rest of Section 2 is initially hidden, then once it appears, it's ugly.  Nothing is lined up and aligned with each other. 

    If the form initially is brought up with everything visible, it's aligned and looks good.  (And I have an addChangeListener that then hides and displays it with no problem.)

    I have tried to programmatically hide the sections at the end of the Create function and I've also tried to hide them programmatically at the end of each group's postRender event.  Any of the three ways (unchecking Is visible, Create function, and postRender event) still results in a form that looks like my 2yo put it together. \

    Any ideas? 

    Thanks! 

    Thursday, August 8, 2013 10:27 PM

All replies

  • Hi,

    I'm interesting in this problem. I use addChangeListener, the display and hide are OK. However I don't know which method you used cause an error. Would you like to show me your code? 

    Friday, August 9, 2013 7:34 AM
  • I have noticed the same and it is on my list to investigate. My first attempt will be to issue a .trigger('create') on the hidden element after showing it. That should trigger JQM to rebuild the rendering for that section. You can look up the docs for that method on the JQM website. Let us know if you solve it before I get to it...

    Regards, Xander. My Blog


    • Edited by novascape Saturday, August 10, 2013 1:21 AM Fixed .create() param
    Friday, August 9, 2013 11:32 AM
  • Thank you for your insight. We have not solved it yet. Instead we are acclimating the client to it.... the sections are visible, he has to toggle the Boolean above it to first YES then NO to get them to hide. This helps in another way - ensures that he DOES set the boolean above it to NO (instead of it remaining as a NULL that's only displayed as a NO). But I will keep your idea in mind if it becomes an issue we really need to solve. THANKS!
    Thursday, August 15, 2013 5:43 PM
  • If the sections are hidden when the screen is created (IsVisible is unchecked in the designer) then later when the user unhides them, they are all out of alignment. But if the sections are visible when the screen is created (IsVisible is checked), then they are created in alignment. the problem is not with the hiding and unhiding, but with how they are created when hidden initially.
    Thursday, August 15, 2013 5:46 PM