<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<link href="//datatables.net/download/build/nightly/jquery.dataTables.css" rel="stylesheet" type="text/css" />
<script src="//datatables.net/download/build/nightly/jquery.dataTables.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.datatables.net/1.11.3/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.datatables.net/1.11.3/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css" />
<meta charset=utf-8 />
<title>DataTables - JS Bin</title>
</head>
<body>
<ul class="nav nav-tabs" role="tablist">
<li class="active">
<a id="0" class="tab_button" href="#tab-table1" data-toggle="tab">ALL</a>
</li>
<li>
<a id="1" class="tab_button"href="#tab-table2" data-toggle="tab">A</a>
</li>
<li>
<a id="2" class="tab_button" href="#tab-table3" data-toggle="tab">B</a>
</li>
<li>
<a id="3" class="tab_button" href="#tab-table4" data-toggle="tab">C</a>
</li>
<li>
<a id="4" class="tab_button" href="#tab-table5" data-toggle="tab">D</a>
</li>
</ul>
<div class="container">
<table id="example" class="display" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
<th>Group</th>
</tr>
</thead>
<tbody>
<tr class="1" type="a">
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$3,120</td>
<td>1</td>
</tr>
<tr class="1" type="a">
<td>Garrett Winters</td>
<td>Director</td>
<td>Edinburgh</td>
<td>63</td>
<td>2011/07/25</td>
<td>$5,300</td>
<td>1</td>
</tr>
<tr class="1" type="a">
<td>Ashton Cox</td>
<td>Technical Author</td>
<td>San Francisco</td>
<td>66</td>
<td>2009/01/12</td>
<td>$4,800</td>
<td>1</td>
</tr>
<tr class="1" type="a">
<td>Cedric Kelly</td>
<td>Javascript Developer</td>
<td>Edinburgh</td>
<td>22</td>
<td>2012/03/29</td>
<td>$3,600</td>
<td>1</td>
</tr>
<tr class="1" type="a">
<td>Jenna Elliott</td>
<td>Financial Controller</td>
<td>Edinburgh</td>
<td>33</td>
<td>2008/11/28</td>
<td>$5,300</td>
<td>1</td>
</tr>
<tr class="2" type="b">
<td>Brielle Williamson</td>
<td>Integration Specialist</td>
<td>New York</td>
<td>61</td>
<td>2012/12/02</td>
<td>$4,525</td>
<td>2</td>
</tr>
<tr class="2" type="b">
<td>Herrod Chandler</td>
<td>Sales Assistant</td>
<td>San Francisco</td>
<td>59</td>
<td>2012/08/06</td>
<td>$4,080</td>
<td>2</td>
</tr>
<tr class="2" type="b">
<td>Rhona Davidson</td>
<td>Integration Specialist</td>
<td>Edinburgh</td>
<td>55</td>
<td>2010/10/14</td>
<td>$6,730</td>
<td>2</td>
</tr>
<tr class="2" type="b">
<td>Colleen Hurst</td>
<td>Javascript Developer</td>
<td>San Francisco</td>
<td>39</td>
<td>2009/09/15</td>
<td>$5,000</td>
<td>2</td>
</tr>
<tr class="2" type="b">
<td>Sonya Frost</td>
<td>Software Engineer</td>
<td>Edinburgh</td>
<td>23</td>
<td>2008/12/13</td>
<td>$3,600</td>
<td>2</td>
</tr>
<tr class="2" type="b">
<td>Jena Gaines</td>
<td>System Architect</td>
<td>London</td>
<td>30</td>
<td>2008/12/19</td>
<td>$5,000</td>
<td>2</td>
</tr>
<tr class="3" type="c">
<td>Quinn Flynn</td>
<td>Financial Controller</td>
<td>Edinburgh</td>
<td>22</td>
<td>2013/03/03</td>
<td>$4,200</td>
<td>3</td>
</tr>
<tr class="3" type="c">
<td>Charde Marshall</td>
<td>Regional Director</td>
<td>San Francisco</td>
<td>36</td>
<td>2008/10/16</td>
<td>$5,300</td>
<td>3</td>
</tr>
<tr class="3" type="c">
<td>Haley Kennedy</td>
<td>Senior Marketing Designer</td>
<td>London</td>
<td>43</td>
<td>2012/12/18</td>
<td>$4,800</td>
<td>3</td>
</tr>
<tr class="3" type="c">
<td>Tatyana Fitzpatrick</td>
<td>Regional Director</td>
<td>London</td>
<td>19</td>
<td>2010/03/17</td>
<td>$2,875</td>
<td>3</td>
</tr>
<tr class="3" type="c">
<td>Michael Silva</td>
<td>Senior Marketing Designer</td>
<td>London</td>
<td>66</td>
<td>2012/11/27</td>
<td>$3,750</td>
<td>3</td>
</tr>
<tr class="3" type="c">
<td>Paul Byrd</td>
<td>Javascript Developer</td>
<td>New York</td>
<td>64</td>
<td>2010/06/09</td>
<td>$5,000</td>
<td>3</td>
</tr>
<tr class="3" type="c">
<td>Gloria Little</td>
<td>Systems Administrator</td>
<td>New York</td>
<td>59</td>
<td>2009/04/10</td>
<td>$3,120</td>
<td>3</td>
</tr>
<tr class="3" type="c">
<td>Bradley Greer</td>
<td>Software Engineer</td>
<td>London</td>
<td>41</td>
<td>2012/10/13</td>
<td>$3,120</td>
<td>3</td>
</tr>
<tr class="3" type="c">
<td>Dai Rios</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>35</td>
<td>2012/09/26</td>
<td>$4,200</td>
<td>3</td>
</tr>
<tr class="4" type="d">
<td>Jenette Caldwell</td>
<td>Financial Controller</td>
<td>New York</td>
<td>30</td>
<td>2011/09/03</td>
<td>$4,965</td>
<td>4</td>
</tr>
<tr class="4" type="d">
<td>Yuri Berry</td>
<td>System Architect</td>
<td>New York</td>
<td>40</td>
<td>2009/06/25</td>
<td>$3,600</td>
<td>4</td>
</tr>
<tr class="4" type="d">
<td>Caesar Vance</td>
<td>Technical Author</td>
<td>New York</td>
<td>21</td>
<td>2011/12/12</td>
<td>$4,965</td>
<td>4</td>
</tr>
<tr class="4" type="d">
<td>Doris Wilder</td>
<td>Sales Assistant</td>
<td>Edinburgh</td>
<td>23</td>
<td>2010/09/20</td>
<td>$4,965</td>
<td>4</td>
</tr>
<tr class="4" type="d">
<td>Angelica Ramos</td>
<td>System Architect</td>
<td>London</td>
<td>36</td>
<td>2009/10/09</td>
<td>$2,875</td>
<td>4</td>
</tr>
<tr class="4" type="d">
<td>Gavin Joyce</td>
<td>Developer</td>
<td>Edinburgh</td>
<td>42</td>
<td>2010/12/22</td>
<td>$4,525</td>
<td>4</td>
</tr>
<tr class="4" type="d">
<td>Jennifer Chang</td>
<td>Regional Director</td>
<td>London</td>
<td>28</td>
<td>2010/11/14</td>
<td>$4,080</td>
<td>4</td>
</tr>
</tbody>
</table>
</div>
<div>
<h5>Age current tab: </h5>
<input id="input-id"/>
</div>
</body>
</html>
body {
font: 90%/1.45em "Helvetica Neue", HelveticaNeue, Verdana, Arial, Helvetica, sans-serif;
margin: 0;
padding: 0;
color: #333;
background-color: #fff;
}
div.container {
min-width: 980px;
margin: 0 auto;
}
var activeTab = null;
$('a[data-toggle="tab"]').on('click', function (e) {
activeTab = this.id;
});
$.fn.dataTable.ext.search.push(
function( settings, searchData, index, rowData, counter ) {
var group = parseFloat( searchData[6] ) || 0;
var idTab = parseFloat(activeTab) || 0;
if((group == idTab) || (idTab == "0")){
return true;
}
return false;
}
);
$(document).ready( function () {
var table = $('#example').DataTable({
bPaginate:false,
"scrollX": true,
"paging": false,
"scrollY": "500px",
"drawCallback": function ( settings ) {
var api = this.api();
var rows = api.rows({search:'applied'}).data().pluck(3).toArray();
var sumage = 0;
for(let value of rows){
sumage += parseFloat(value) || 0;;
}
$('#input-id').val(sumage);
}
});
$('.tab_button').on('click',function(){
table.draw();
});
} );
You can jump to the latest bin by adding /latest
to your URL
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + [ | Indents selected lines |
ctrl + ] | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Clone Bin |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |