Skip to Content
Former Member
Jul 15, 2015 at 03:01 PM

Problem hiding elements in grid


Hello everyone,

it is the first time i start a discussion, but i really need help with my SAPUI5 app.

I have a sap.ui.layout.Grid with many elements in its content agregation. Depending on the binding the grid should show some elements or not.

You can do this by binding the visible property of the elements, the problem is that it keeps the blank space in the layout and i dont want that. If i use a GridData as a layoutData of each element and i bind the visibleL property, it works fine, the problem is when i also want to bind/set the visibleM and visibleS properties, because if i set the 3 properties to the same value, it looks like the application ignores them.

Here is an simple example of the code:

new sap.ui.layout.Grid({

  defaultSpan: "L2 M6 S12",
  hSpacing: 1,
  position: "Left",
  vSpacing: 1,
  width: "100%",
  new sap.m.Label({
       text: "Company:",
     layoutData: new sap.ui.layout.GridData({
            visibleL: false,
            visibleM: false,
            visibleS: false,

with this code, the label is still visible, but if i comment the 13th or 14th line, it works fine.

Anyone knows what is happening and how can i solve it?

Thank you very much,