Hi Geeks,
I have faced an issue in XPages when computing the style property in All Properties of an element. For an instance I want to hide an Editbox in a table cell which is highly decorated with the style classes. So I have written the following code to hide ( Not using visible property of the element) the Editbox using CSS.
var x = getComponent("fieldName").getValue();
if(x == 1)
{
return "display:none"
}
else
{
return "display:block"
}
The above code works well but it affects the style given through its style class. For that particular cell and row no styles were applied. Cell height and width were changed annoyingly.
The fix is very simple. Just return the empty string in the else condition. Then it will take the styles from the style class.
var x = getComponent("fieldName").getValue();
if(x == 1)
{
return "display:none"
}
else
{
return ""
}
This issue occurs only when the style property is computed. But not for static style (Like inline style which is not computed). I hope this helps.
No comments:
Post a Comment