2011-10-27 110 views
1

我有一個MySQL查詢獲取通過PHP顯示。每個返回的記錄都被分配一個複選框。表(ReleaseNumber)中的一列包含一個編號不同記錄的編號。如何通過版本號創建可摺疊的複選框組。我附上了當前狀態的圖片和我之後的內容(Outlook截圖)。用戶可以摺疊或展開行組。如果選擇了一個行組,則所有的子行也被選中。摺疊和擴展組的複選框

這可以做到,如果是的話如何? 電流: enter image description here 期望: enter image description here

我的代碼是:

<?php 
    mysql_connect("localhost", "username", "password")or die("cannot connect");  
    mysql_select_db("database")or die("cannot select DB"); 
    $sql="SELECT`despgoodsid` ,`crtd dept` ,`customer` ,`loc cust rel` ,`case no` ,`gross mass` ,`case width` ,`case length` FROM despgoods_alldetails WHERE transporttypename ='localjhb' AND locstatus ='unplanned' AND customer <>'customer' AND `loc cust rel` > 0 "; 
    $result=mysql_query($sql); 
    $count=mysql_num_rows($result); 
    putenv("TZ=Africa/Johannesburg"); 

?> 
<table border=0> 
    <tr> 
     <td> 
      <form name="form1" method="post"> 
       <table border=0 id="hor-minimalist-a"> 
        <tr> 
         <th>&nbsp;</th> 
         <th width=150><center>Release Number</th> 
         <th width=150>Dispatch Area</th>       
         <th width=150>Customer</th> 
         <th width=130><center>Case Number</th> 
         <th width=80><center>Weight</th> 
         <th width=80><center>Width</th> 
         <th width=80><center>Length</th> 
        </tr> 
<?php 
    while($rows=mysql_fetch_array($result)){ 
?> 
        <tr> 
         <td><input type="checkbox" name=check[] value="<?php echo $rows['despgoodsid']; ?>"></td> 
         <td><center><?php echo $rows['loc cust rel']; ?></td> 
         <td><?php echo $rows['crtd dept']; ?></td> 
         <td><?php echo $rows['customer']; ?></td> 
         <td><center><?php echo $rows['case no']; ?></td> 
         <td><center><?php echo $rows['gross mass']; ?></td> 
         <td><center><?php echo $rows['case width']; ?></td> 
         <td><center><?php echo $rows['case length']; ?></td> 

        </tr>         

<?php 
    } 
?> 
        </table> 
        <table> 
        <tr> 
         <td colspan=3><input name="Next" type="submit" id="Next" value="Next"></td> 
        </tr></table> 

我需要一些Java來完成呢?任何建議是一如既往的讚賞?

感謝和問候, 萊恩史密斯

回答

0

有幾種方法來實現這一目標。你不需要Java。你需要Javascript。

以下jQuery的功能來幫助你完成這個: