laimas,
идея понятна но код не рабочий ...
Сообщение от рони
|
найдите разницу пост№2 тут и пост №17 тут
|
Сообщение от рони
|
$(document).ready(function(){ 2 $('#myTable').DataTable(); 3 4//где код ? 5 });
|
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
#myTable tbody tr{
display: none;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<link rel="stylesheet" href="//cdn.datatables.net/1.10.13/css/jquery.dataTables.css">
<script src="http://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
<script>
$(function() {
$("#myTable").DataTable({
"paging": false,
"ordering": false,
"info": false
});
$("#myTable").find("[data-box]").on("click", function() {
var cls = "." + $(this).data("box");
$(cls).toggle()
})
});
</script>
</head>
<body>
<table border="1" id="myTable" class="display">
<thead>
<tr>
<th colspan="6">
<table><thead><tr>
<td data-box="as1">Надо развернуть1</td>
<td data-box="as2">Надо развернуть2</td>
<td data-box="as3">Надо развернуть3</td>
<td data-box="as4">Надо развернуть4</td>
<td data-box="as5">Надо развернуть5</td>
<td data-box="as6">Надо развернуть6</td>
</tr></thead></table>
</th>
</tr>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<tr class="as1" >
<th>Tiger Nixon</th>
<th>System Architect</th>
<th>Edinburgh</th>
<th>61</th>
<th>2011/04/25</th>
<th>$320,800</th>
</tr>
<tr class="as1" >
<th>Tiger Nixon2</th>
<th>System Architect</th>
<th>Edinburgh</th>
<th>61</th>
<th>2011/04/25</th>
<th>$320,800</th>
</tr>
<tr class="as2" >
<th>Garrett Winters</th>
<th>Accountant</th>
<th>Tokyo</th>
<th>63</th>
<th>2011/07/25</th>
<th>$170,750</th>
</tr>
<tr class="as2" >
<th>Garrett Winters</th>
<th>Accountant</th>
<th>Tokyo</th>
<th>63</th>
<th>2011/07/25</th>
<th>$170,750</th>
</tr>
<tr class="as3" >
<th>Ashton Cox</th>
<th>Junior Technical Author</th>
<th>San Francisco</th>
<th>66</th>
<th>2009/01/12</th>
<th>$86,000</th>
</tr>
<tr class="as3" >
<th>Ashton Cox</th>
<th>Senior Javascript Developer</th>
<th>Edinburgh</th>
<th>22</th>
<th>2012/03/29</th>
<th>$433,060</th>
</tr>
<tr class="as3" >
<th>Ashton Cox</th>
<th>Accountant</th>
<th>Tokyo</th>
<th>33</th>
<th>2008/11/28</th>
<th>$162,700</th>
</tr>
<tr class="as4" >
<th>Cedric Kelly</th>
<th>Integration Specialist</th>
<th>New York</th>
<th>61</th>
<th>2012/12/02</th>
<th>$372,000</th>
</tr>
<tr class="as4" >
<th>Cedric Kelly</th>
<th>Sales Assistant</th>
<th>San Francisco</th>
<th>59</th>
<th>2012/08/06</th>
<th>$137,500</th>
</tr>
<tr class="as5" >
<th>Airi Satou</th>
<th>Integration Specialist</th>
<th>Tokyo</th>
<th>55</th>
<th>2010/10/14</th>
<th>$327,900</th>
</tr>
<tr class="as5" >
<th>Airi Satou</th>
<th>Javascript Developer</th>
<th>San Francisco</th>
<th>39</th>
<th>2009/09/15</th>
<th>$205,500</th>
</tr>
<tr class="as5" >
<th>Airi Satou</th>
<th>Software Engineer</th>
<th>Edinburgh</th>
<th>23</th>
<th>2008/12/13</th>
<th>$103,600</th>
</tr>
<tr class="as6" >
<th>Brielle Williamson</th>
<th>Office Manager</th>
<th>London</th>
<th>30</th>
<th>2008/12/19</th>
<th>$90,560</th>
</tr>
<tr class="as1" >
<th>Tiger Nixon</th>
<th>System Architect</th>
<th>Edinburgh</th>
<th>61</th>
<th>2011/04/25</th>
<th>$320,800</th>
</tr>
<tr class="as1" >
<th>Tiger Nixon2</th>
<th>System Architect</th>
<th>Edinburgh</th>
<th>61</th>
<th>2011/04/25</th>
<th>$320,800</th>
</tr>
<tr class="as2" >
<th>Garrett Winters</th>
<th>Accountant</th>
<th>Tokyo</th>
<th>63</th>
<th>2011/07/25</th>
<th>$170,750</th>
</tr>
<tr class="as2" >
<th>Garrett Winters</th>
<th>Accountant</th>
<th>Tokyo</th>
<th>63</th>
<th>2011/07/25</th>
<th>$170,750</th>
</tr>
<tr class="as3" >
<th>Ashton Cox</th>
<th>Junior Technical Author</th>
<th>San Francisco</th>
<th>66</th>
<th>2009/01/12</th>
<th>$86,000</th>
</tr>
<tr class="as3" >
<th>Ashton Cox</th>
<th>Senior Javascript Developer</th>
<th>Edinburgh</th>
<th>22</th>
<th>2012/03/29</th>
<th>$433,060</th>
</tr>
<tr class="as3" >
<th>Ashton Cox</th>
<th>Accountant</th>
<th>Tokyo</th>
<th>33</th>
<th>2008/11/28</th>
<th>$162,700</th>
</tr>
<tr class="as4" >
<th>Cedric Kelly</th>
<th>Integration Specialist</th>
<th>New York</th>
<th>61</th>
<th>2012/12/02</th>
<th>$372,000</th>
</tr>
<tr class="as4" >
<th>Cedric Kelly</th>
<th>Sales Assistant</th>
<th>San Francisco</th>
<th>59</th>
<th>2012/08/06</th>
<th>$137,500</th>
</tr>
<tr class="as5" >
<th>Airi Satou</th>
<th>Integration Specialist</th>
<th>Tokyo</th>
<th>55</th>
<th>2010/10/14</th>
<th>$327,900</th>
</tr>
<tr class="as5" >
<th>Airi Satou</th>
<th>Javascript Developer</th>
<th>San Francisco</th>
<th>39</th>
<th>2009/09/15</th>
<th>$205,500</th>
</tr>
<tr class="as5" >
<th>Airi Satou</th>
<th>Software Engineer</th>
<th>Edinburgh</th>
<th>23</th>
<th>2008/12/13</th>
<th>$103,600</th>
</tr>
<tr class="as6" >
<th>Brielle Williamson</th>
<th>Office Manager</th>
<th>London</th>
<th>30</th>
<th>2008/12/19</th>
<th>$90,560</th>
</tr>
</tbody>
</table>
</body>
</html>