I have one table which display data as from Dynamic Content in 1 column. I would like the content to move to a second column when the number of cell is >3. (ie. if there are 3 cells to display, it would be display in 1 col, and 4 cells or more it would be displayed in 2 columns. Note that the dynamic content will never go over 6 cells.
I have to say I can find my way with css and html but javascript is another issue… however I do realize it might be the only way.
Any Javascript , jQuery script available to get my result?
Data to be displayed like so:
| Col1 | | Col1 || Col2 |
--------- -----------------
| Data1 | ----> | Data1 || Data4 |
| Data2 | | Data2 | etc...
| Data3 | | Data3 |
Not sure if this would help but the Code calling for the dynamic content (and putting it in the table) is:
<table id="myTable">
<?php
$str1="";
$flag1=1;
while($rowReview1=mysql_fetch_array($resultReview1)){
$st1="";
$val=$rowReview1["ratingValue"];
$sName=$rowReview1["criteriaName"];
if($val>0){
for($ii=1;$ii<=$val;$ii++){
$st1.="<img src=\"$directory/images/orange.gif\" \>";
}
for($jj=$val;$jj<5;$jj++){
$st1.="<img src=\"$directory/images/gray.gif\" \>";
}
}else{
$st1="";
}
if($val > 0){
$str1.="<tr><td>$sName</td><td>$st1</td></tr>";
}else{
$str1.="<tr><td>$sName</td><td>N/A</td></tr>";
}
}
echo $str1;
?>
</table>
The page can now be seen live here: http://www.top10banques.com/avis/index2.php?item_id=1
The tables I’m trying to edit are the ones below the page break “l’evaluation des clients”.
Thanks again for any help you could provide and Happy Holidays to all!
Assuming you’re using standard table structure, first I would put all your data into one column, regardless of how many there are. Then I would move them dynamically:
EDIT
Here’s a working sample of what you’re trying to do. The problem was you have TWO div cells per row, I thought you only had one:
NOTE the above solution will only work to your exact specifications. If you want this to be reusable (ie, takes any number of rows with any number of cells), you may have to do some additional tweaking.
WORKING UPDATE FOR MULTIPLE TABLES
See the code I posted here on Pastie: http://pastie.org/755963
Note that the tables are now referenced by classes instead of ids. Also, I want to say that I agree that this solution could (and maybe should) be handled server side, I am merely answering the question as the OP asked…