locked
How to hide a Hub Section (via data-binding)

    Question

  • I need my hub to display different sections for different user choices (made from a dropdown above the hub control).

    The Hubs Sections are all coded in the HTML that also contains the hub. So just removing hub.sections will also remove the HTML element of this section I guess? And then I could not add it back. How would one solve this?

    Load all hub sections from external files?

    Monday, August 11, 2014 2:32 PM

Answers

  • Hi pkursawe,

    Correct, remove/dispose hub.section will also remove the HTML of the section, however if we know which hub section should not display, we can hide it via CSS.

    If we own the data source, remove some section and render them when necessary is another possibility.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Tuesday, August 12, 2014 1:46 AM
    Moderator

All replies

  • Hi pkursawe,

    Correct, remove/dispose hub.section will also remove the HTML of the section, however if we know which hub section should not display, we can hide it via CSS.

    If we own the data source, remove some section and render them when necessary is another possibility.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Tuesday, August 12, 2014 1:46 AM
    Moderator
  • Hiding the section just with "display:none"? And the Hub does not get confused in its calculations by that?
    Tuesday, August 12, 2014 8:46 AM
  • This works, but can I force the hub to recalculate its viewport? Otherwise its not scrolling correctly.
    • Edited by pkursawe Wednesday, August 20, 2014 9:33 AM
    Wednesday, August 20, 2014 9:33 AM
  • Scrolling incorrect is expected, due to the suggested way to implement this is to modify the data source backend, if the current hubsection is not need to display, remove it from HTML content, but now we are hiding the hubsection by CSS.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, August 20, 2014 9:40 AM
    Moderator
  • ok, so I have to load the sections dynamically. But I don't want to compose their content myself. Can I put each section in its own HTML file?
    Wednesday, August 20, 2014 12:41 PM