Xpages how to hide table cell

Greetings,

I am trying to hide the table cell and not just the data in an xpage. I am using the formula to check if the document is new and if not then hide the cells. The problem I am having is that it hides the data but not the cell itself, so when you I at the page I am seeing a large gap of empty space. I have searched all over for this topic but have not seen anything. Any advice would be greatly appreciated. I am currently using the code below in the visible computed section of the table cell.

if (@IsNewDoc()==1){

return 1;

}

Subject: I’m not sure what it means to hide a table cell

Here is a table:

a

b

c

d

e

f

g

h

i

What does it mean to hide the cell containing “e”? Does the middle row get shorter? Is there a blank spot in the middle of the table?

When you calculate something as not visible, it’s still there in the HTML. It’s just a question of whether the browser is instructed to display it or hide it. Some things, when they’re not visible, the stuff around them can easily be moved to fill the gap. But a table is not as flexible.

If you have done this “visible formula” in all the cells of an entire column, then you maybe expect the browser will be smart enough to close up the gap. But apparently not.

I think you might try using that formula in the rendered property of the cell, rather than the visible property. Of course, this will look funny if there’s a whole column whose cells don’t have the same value for this property.

Subject: My experience, such as it is…

  • If one sets “visible” in the Design tab, which actually sets “render=” on the appropriate element in the Source tab, then the browser does NOT see it. The difference:

  • If the browser sees it and does not show it, then it will appear in View Source with a style of “display:none” or some such. These elements appear greyed out in FireBug’s HTML view.

  • If the browser does not see it, it does not appear in View source. These elements also fail to appear in FireBug, because they don’t exist, as far as the browser is concerned.

  • I just double-checked this on navigator of mine that uses “render=” to dynamically present or hide entries. When “hidden”, the entries are utterly gone from the browser. I consider this a Good Thing! ™

  • As such, I’d still go with Andre’s suggestion: set render= for the actual xp:tr (for a row) or xp:td (for a column) and the cells should be completely gone. To re-iterate what Andre also said, be double-dog sure to do this to all column entries (if doing only a column) or it’ll be a mess.

  • Lastly, my navigator uses a table, so it’s doing <xp:tr render=“some js”>. It occurs to me that other XPage elements may behave differently, but one could hope they are consistent.

Hope this helps…

P.S. The other attribute, loaded=, has much the same effect in my experience. The difference is that XPage command processor will fully and completely process an element that has render=, even if it’s false, where it will utterly ignore an element that has loaded=false. The other difference is that render= is valid on many, many more elements than loaded=, though strangely it’s not valid on all of them.

The hack is to wrap the element in <xp:panel render=“some js”>, or

if you need to dynamically hide something when the XPage compiler complains that render= isn’t valid.