0

Hidden components inside vlayout cause whitespace

asked 2012-03-10 21:00:02 +0800

vsony7 gravatar image vsony7
102 1

Hi,

I added some vboxes within a vlayout. I set the visibility of some vboxes to true and the visibility of other vboxes to false. However, the hidden boxes cause extra white space in my layout. I expect the hidden components to not take up any space in the layout. Please see my code below:

<vlayout style="border: 1px solid #86A4BE;" hflex="1">
  <vbox hflex="1">
    Box 1
  </vbox>
  <vbox hflex="1" visible="false">
    Box 2
  </vbox> 
  <vbox hflex="1" visible="false">
    Box 3
  </vbox> 
  <vbox hflex="1" visible="false">
    Box 4
  </vbox> 
  <vbox hflex="1" visible="false">
    Box 5
  </vbox> 
  <vbox hflex="1">
    Box 6
  </vbox>
</vlayout>

Thanks,
Sony

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2012-03-22 02:01:53 +0800

vsony7 gravatar image vsony7
102 1

I noticed by inspecting the page that some padding is added to each component inside a vlayout. To be specific, the following style is applied for all the inner vboxes. I am not able to override this style.

element.style {
padding-bottom: 0.3em;
}

Thanks,
Sony

link publish delete flag offensive edit

answered 2012-03-22 13:05:52 +0800

RichardL gravatar image RichardL
768 4

A div with block elements might be a better choice if you don't want the padding.

link publish delete flag offensive edit

answered 2012-03-22 19:13:02 +0800

vsony7 gravatar image vsony7
102 1

Hi Richard,

Thanks. Replacing vlayout with a div works fine for my simplified example. However, flexes don't work very well in a more complicated scenario. for e.g., I may add an <include> to add another page which has a bunch of inner components wrapped inside a vlayout. Changing this vlayout to div disturbs the flex.

Rather than trying to replace all vlayouts with a div in my application, I was wondering if there's a way I can override the vlayout style to remove the padding. I tried a number of combinations but I couldn't find a work around. Thank You.

link publish delete flag offensive edit

answered 2012-03-23 01:19:01 +0800

RichardL gravatar image RichardL
768 4

Hi Sony,
Try this: <style>.z-vlayout-inner{padding:0 !important;}</style>

link publish delete flag offensive edit

answered 2012-03-23 04:35:03 +0800

vsony7 gravatar image vsony7
102 1

Yes, That works! Thanks! I will remember the "!important" trick for future.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-03-10 21:00:02 +0800

Seen: 196 times

Last updated: Mar 23 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More