Jump to content

repeating table problem


samoht

Recommended Posts

hello again,

 

so I thought I was all done with my repeating tables of "features" - because all was well in fierfox - but of course when I tested on ie my hopes where dashed.

 

In firefox the tables stack side by side until they reach the edge of the table they are nested in then they start a new row of tables on the next line. In IE the tables continue to populate 1 single line inspite of the fact that the user cannot see them.

 

any ideas how to fix??

 

 

here is the code:

<?php ?>     
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="padding-left:7px; background:#eee">
        <tr>
          <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="mb">Item Features</td>
            </tr>
            <tr>
              <td><?php
			$max_per_col  = 15;
			$current_type = "";
			$feature_num  = 0;
			$tr_num			  = 0;

			echo '<table border="0" cellspacing="0" cellpadding="0" align="left" class="features" >';

while ($row = mysql_fetch_assoc($rsAllFeatures)) {

  //If new type show new type header
  if ($current_type != $row['Type']) 
{	
    //If not first type close previous type
    if ($current_type != "") 
	{
      $pad = $max_per_col - $feature_num;
		for($t=0;$t<=$pad;$t++)
		{
		  echo "\n\t<tr><td> </td></tr>";
		} 
		echo "\n\t</table><table border='0' cellspacing='0' cellpadding='0' align='left' class='features'>\n";
    $feature_num = 0;
    }

    $current_type = $row['Type'];
    echo "\n\t<tr><td class='sb' width='124' >$current_type:</td></tr>\n";

  }

echo "<tr><td style=\"font-size:9px\" width='124' ><input onClick=\"changeColor(this.id, '#009900');\" type=\"checkbox\" name=\"FeatureId[]\" id=\"FeatureId$row[FeatureId]\" value=\"$row[FeatureId]\"";
					foreach($ItemsFeatures as $FeatureId){
						if($FeatureId==$row['FeatureId'])
							echo "checked";
					}
				echo ">";
echo "<label id=\"LabelFeatureId".$row['FeatureId']."\" for=\"FeatureId".$row['FeatureId']."\">".$row['Name']."</label></td></tr>\n";
  $feature_num++;

  //If the 15th item close td and start new one
  if ($feature_num >= $max_per_col) {
	echo "</table><table border='0' cellspacing='0' cellpadding='0' align='left' class='features'>\n";//"</td><td>\n";
	echo "\t<tr><td> </td></tr>\n";
    $feature_num = 0;
  }

}

echo "</td></tr></table>\n";?></td>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td>
	  </td>
        </tr>
      </table>

Link to comment
Share on other sites

I didn't know Firefox automatically repositioned cells like that. I don't think there is any possible way of making IE do a similar thing the way your table works. IE uses strictly rows and columns, so when you add a column (<td>), even if you check the size of the page, you can't send that column somewhere else without making a new row. You are going to have to use a different method.

 

You might want to make a separate table for each group and use some relative positioning to get them where you want.

Link to comment
Share on other sites

You could get divs you work, but you would need to check for a maximum number of columns. I would use one big div for the first block of content. Inside that div would be a div for each column; these divs would need to have inline positioning set. Then, once it gets to wide, make another big div block to put more columns in and they will go underneath the other block. The heights should set themself dynamically.

Link to comment
Share on other sites

well, I changed the tables to div's and floated them left - and that works pretty well.

 

But I would like to have the checkboxes and the empty lines the same width and height. Do I need to display:block and set the width and height of a <p> then in the blank lines throw in a <p> </p>

??

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.