1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Tableau entete fixe</title>
<style type='text/css'>
table.TableMain{
border: 1px solid black; /* Couleur cadre extérieur du tableau */
font:10px Verdana,Arial; background:#F0F8FF; color:#091f30; /*Taille, couleur police*/
}
thead tr th, tfoot tr th {
cursor:pointer;
font:12px Verdana;
color:#ffffff; /*Couleur du texte*/
/*font-weight: bold; //Option : texte en gras */
text-align:left;
background-color: #4169E1; /* Couleur de l'entête */
}
.scrollTable th, .scrollTable td{
padding: 4px; /*espacement entre les lignes*/
border: solid black; /*Couleur des lignes intérieur du tableau*/
border-width: 0 1px 1px 0px; /* ajout de bordure et épaisseur bordure : horizontale, verticale */
}
.scrollTable{ width:100% }
.scrollTable > tbody{
height:300px;
overflow:auto;
}
.scrollTable .th_extra{
width: 18px;
padding: 0;
border-right-width: 0;
}
.TableContainer > .scrollTable .th_extra{ width: 18px; }
</style>
<!--[if IE]>
<style type="text/css">
div.TableContainer {
height: 600px;
overflow: auto;
width: 100%;
}
thead.fixedHeader tr {
position: relative;
}
.scrollTable{width: expression(this.parentNode.offsetWidth-17);}
.th_extra{display:none;}
</style>
<![endif]-->
<script type="text/javascript">
function xhr()
{
var xmlHttp = null;
if(window.XMLHttpRequest)
xmlHttp = new XMLHttpRequest();
else if(window.ActiveXObject)
{
try
{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
else {
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
xmlHttp = false;
}
return xmlHttp
}
//******************************************************************
function tri_dpt(){
var xmlHttp = xhr()
var reponse = document.getElementById('liste_tableau');
var selectEsp = document.getElementById('dpt');
var selectedEspece = selectEsp.options[selectEsp.selectedIndex].value;
if (selectedEspece=='-1'){
reponse.innerHTML = '';
}
else {
var url = "tableau.php?";
var data = "dpt="+selectedEspece; url +=data;
xmlHttp.open("get",url,true);
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4 && xmlHttp.status==200)
{
reponse.innerHTML = xmlHttp.responseText;
}
}
xmlHttp.send(null);
}
}
function tri_unite(){
var xmlHttp = xhr()
var reponse1 = document.getElementById('liste_tableau');
var selectEsp = document.getElementById('unite');
var selectedEspece = selectEsp.options[selectEsp.selectedIndex].value;
if (selectedEspece=='-1'){
reponse1.innerHTML = '';
}
else {
var url = "tableau.php?";
var data = "unite="+selectedEspece; url +=data;
xmlHttp.open("get",url,true);
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4 && xmlHttp.status==200)
{
reponse1.innerHTML = xmlHttp.responseText;
}
}
xmlHttp.send(null);
}
}
function tri_site(){
var xmlHttp = xhr()
var reponse2 = document.getElementById('liste_tableau');
var selectEsp = document.getElementById('site');
var selectedEspece = selectEsp.options[selectEsp.selectedIndex].value;
if (selectedEspece=='-1'){
reponse2.innerHTML = '';
}
else {
var url = "tableau.php?";
var data = "site="+selectedEspece; url +=data;
xmlHttp.open("get",url,true);
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4 && xmlHttp.status==200)
{
reponse2.innerHTML = xmlHttp.responseText;
}
}
xmlHttp.send(null);
}
}
</script>
</head>
<body>
<?php $dpt=$_GET["dpt"];
$unite=$_GET["unite"];
$site=$_GET["site"];
?>
<div id='liste_tableau'>
<form method="post" action="" name="formulaire">
<table border='0' cellspacing='0' cellpadding='0' class='TableMain' width='100%'>
<tr>
<td>
<div class="TableContainer">
<table border='0' cellspacing='0' cellpadding='0' class="scrollTable">
<thead class="fixedHeader">
<tr height='40px'>
<th>Département<br><br><select id='dpt' name='dpt' onchange='tri_dpt();'>
<option value='-1'> Tous </option>
<?php
$res1 = mysql_query("select dpt from commande group by dpt");
while($row1 = mysql_fetch_array($res1)){
echo "<option value='".$row1['dpt']."'>".$row1['dpt']."</option>";
} ?></select></th>
<th>Unité<br><br><select id='unite' name='unite' onchange='tri_unite();'>
<option value='-1'> Tous </option>
<?php
$res2 = mysql_query("select unite from commande group by unite");
while($row2 = mysql_fetch_array($res2)){
echo "<option value='".$row2['unite']."'>".$row2['unite']."</option>";
} ?></select></th>
<th>Site<br><br><select id='site' name='site' onchange='tri_site();'>
<option value='-1'> Tous </option>
<?php
$res3 = mysql_query("select site from commande group by site");
while($row3 = mysql_fetch_array($res3)){
echo "<option value='".$row3['site']."'>".$row3['site']."</option>";
} ?></select></th>
<th>Quantité</th>
<th class='th_extra'></th>
</tr>
</thead>
<tbody class="scrollContent">
<?php
if($dpt || $unite || $site !=''){
$tri = "where dpt='".$dpt."' or unite='".$unite."' or site='".$site."'";
$a = mysql_query("select dpt, unite, site, quantite from commande $tri order by dpt");
}else{$a = mysql_query("select dpt, unite, site, quantite from commande order by dpt");}
while($b = mysql_fetch_array($a)){
?>
<tr>
<td><?php echo $b['dpt']; ?></td>
<td><?php echo $b['unite']; ?></td>
<td><?php echo $b['site']; ?></td>
<td><?php echo $b['quantite']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</td>
</tr>
</table></form>
</div>
</body>
</html> |
Partager