Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to make a column dynamic ?

 
Tawfeeq Al-Moumen
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I've tried to make my columns dynamic by using rendered property.
everything went fine except that the header values didn't show.
so, would please give some explanations about this issue ?

regards,

<rich:dataTable value="#{stationLoad.results}"
cellpadding="0" cellspacing="0"
width="700" border="0" var="record">
<rich:column>
<f:facet name="header">
<hutputText value="Hour"/>
</f:facet>
<hutputText value="#{record.time}"/>
</rich:column>
<rich:column rendered="#{record.mvar}">
<f:facet name="header">
<hutputText value="MVAR"/>
</f:facet>
<hutputText value="#{record.mvarValue}"/>
</rich:column>
<rich:column rendered="#{record.mw}">
<f:facet name="header">
<hutputText value="MW"/>
</f:facet>
<hutputText value="#{record.mwValue}"/>
</rich:column>
</rich:dataTable>
 
Darryl Nortje
Ranch Hand
Posts: 140
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tawfeeq,

What do you mean the header values aren't showing?

It looks like you're defining the header values inside component that you have the rendered tag on.

EG:


So the header value MVAR will not display as well as the value of record.mvarValue based on the value of record.mvar.

Am I understanding your question correctly?

Tjeers
Darryl
 
Tawfeeq Al-Moumen
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Darryl Nortje,

sorry for not giving you more detail.

what I have noticed that there is no problem will happen to the column if the rendered property is false
but if the rendered property is true, it showed me the data and hide the header name.
[ November 10, 2008: Message edited by: Tawfeeq Al-Moumen ]
 
Tawfeeq Al-Moumen
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any solution or idea for this problem ???
 
ren feiyang
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This situation,I have ever come across.

The solution is below:

First,You should use rendered in
<rich:dataTable var="m" value="#{beanname.property}">
<rich:column>
<hutputText id="" value="#{m.property}" rendered="#{m.property =='' ?ture:false}">

</rich:column>

my Msn:is renfeiyang123@live.cn. you can communicate with me.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic