Hide/show 2 table rows when having data

67 Views Asked by At

I need to display 2 empty table row when don't have any data and when they do have data those 2 empty table rows should be hidden. Now i can write the code for display data in the table rows but it doesn't display 2 empty table rows when it doesn't have data, so please help me to solve this problem. thank you.

Image outlining problem above

<table class="message_table" width="1025" border="0" cellspacing="1" cellpadding="5" align="center" bgcolor="#c9c9c9">
            <tr style="background-color:#797a7b;">
              <td style="color:#fff;">序号</td>
              <td style="color:#fff;">模式</td>
              <td style="color:#fff;">时时彩返点</td>
              <td style="color:#fff;">11选5返点</td>
              <td style="color:#fff;">低频返点</td>
              <td style="color:#fff;">操作</td>
            </tr>
            <a4j:repeat value="#{AgentAutoRegBean.reslist}" var="list"
      id="dblist" rowKeyVar="keys">
      <tr style="background:#{keys%2==1?'#EEEEDD':'#f4f4f4'}">
       <td>#{keys+1}</td>
       <td>#{list.model}</td>
       <td>
        <h:outputText value="#{list.pointssc}" converter="PercentConverter"/>
       </td>
       <td>
        <h:outputText value="#{list.point115}" converter="PercentConverter"/>
       </td>
       <td>
        <h:outputText value="#{list.pointdp}" converter="PercentConverter"/>
       </td>
       <td>
        <font color="#5a5a5a">
         <a4j:commandLink value="编辑" status="normalStatus" action="#{AgentAutoRegBean.edit}" data="#{AgentAutoRegBean.msg}" oncomplete="edit01(data)">
          <f:param name="sign" value="#{list.sign}"/>
         </a4j:commandLink>
         <rich:spacer width="8"></rich:spacer>
         <a4j:commandLink value="网址" onclick="winopen('#{list.sign}');return false;">
         </a4j:commandLink>
        </font>
       </td>
      </tr>
     </a4j:repeat>
           </table>

1

There are 1 best solutions below

0
Albin On

If you want to fill it later you have to use the var attribute of the a4j:repeat and prepare a list with 2 (empty) elements in the backing bean before access the data and use listeners for fill the list later.