How to best handle hidden components using Layout

edited April 2012 in Enyo 2
Stumbled on this using Books, but it's a general Enyo issue.

It appears that any components using Layout that are not initially showing are not rendered correctly when they are shown. I have to call resized() to get the layout to display correctly everytime I show. The issue also appears when the viewport changes size.

http://jsfiddle.net/em9Gj/

Thoughts?

Comments

  • Add "this.render()" seems to make it work.
    toggleView: function(inSender, inEvent) {
            this.controls[this.viewIdx].hide();
            this.viewIdx = this.viewIdx === 1 ? 0 : 1;
            this.controls[this.viewIdx].show();
           this.render();
        },
  • Cool, so both render() and resized() make it work. render() reads better, but I'd bet resized() is faster.

    The lazy in me would rather not render/resize everytime I show something that could contain a Layout and doesn't seem to be any event announced when visibility is toggled.

    So is that my only choice?
  • Probably because toggling visibility is manual, so there is nothing internal in any of the base controls that would fire such an event. Just run a resize after showing/hiding, or if you want to go one further, override the show/hide methods to call render/resize automatically.
Sign In or Register to comment.