Pi Horse Pi Horse - 1 year ago 87
HTML Question

HTML table td display

I have multiple HTML tables which has some Ruby code embedded in it. It looks like below :

<% loop-1 %>
<td rowspan=" X ">abcd</td>

<% loop-2 %>
<% if (condition) %>
<% end %>
<% end %>
<% end %>

So as seen above, there are multiple tables generated based on loop-1. Now each table will have atleast one row. After the first row, there is again another loop-2 and some condition. There might be variable number of rows after the first row for each table. I want the first of the first to have the rowspan(X) = no. of total rows for that table.

For example. if after the first row, loop-2 generates 2 more rows, I want the X=3

Answer Source

You can't do that using only HTML. The only possible way is to count how many occurrence of condition will take place befroe your loop. I.e. executing the same loop earlier and increment X each time condition met.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download