locked
Why does a ListView with display:none or 0px size not get populated with itemDataSource?

    Question

  • I have two ListViews, one GridLayout, one ListLayout. GridLayout is for normal view, ListLayout one will be for snapped view.

    Issue is, with the GridLayout one showing and the ListLayout one hidden, I switch to Snap, using CSS for the snap view I switch the display values so the ListLayout is visible...issue is that it's empty.

    I then did some playing around, and noticed that ListViews with display:none, don't get populated.

    Is there a reason why?

    I probably have another way to do it, to hide stuff inside the ListViews...but I'm still perplexed to why the display CSS property affects the lists population of data.


    • Edited by Harlequin Wednesday, May 09, 2012 2:19 PM Update title...
    Tuesday, May 08, 2012 4:25 PM

Answers

  • Hey H,

    I would imagine 0px display is making the decision to not bind since it would be pointless without the ability to render.  In fact if I remember correctly it takes the render to populate the element.  Does this affect your app in some way?

    -Jeff


    Jeff Sanders (MSFT)

    Wednesday, May 09, 2012 2:58 PM
    Moderator

All replies

  • Or...I wasn't binding my 2nd listview to anything. Goooood Lord.

    EDIT

    Updating something weird. If a ListView has a size 0px/0px I guess it doesn't get bound, or nothing gets put into it's DOM?


    Just did an experiment. ListView with 1px/1px size gets populated(I make it 283px x 100% in the snap CSS). If no size, nothing goes into it.
    • Edited by Harlequin Tuesday, May 08, 2012 11:13 PM Update with experiement
    Tuesday, May 08, 2012 10:50 PM
  • Hey H,

    I would imagine 0px display is making the decision to not bind since it would be pointless without the ability to render.  In fact if I remember correctly it takes the render to populate the element.  Does this affect your app in some way?

    -Jeff


    Jeff Sanders (MSFT)

    Wednesday, May 09, 2012 2:58 PM
    Moderator