Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Code samples
  • Loading branch information
c0ff3m4kr committed Sep 4, 2014
1 parent 48453c6 commit 26572bb
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,61 @@ SelecTable.js

Selectable Tables.

Add the following css to your rows:
Nothing special in the table:
```HTML
<table class="my-selectable">
<thead>
<tr>
<th>
<!-- add here the checkbox to toggle all -->
<input type="checkbox" id="all_checkbox" />
</th>
<th>Filename</th>
</tr>
</thead>
<tbody>
<tr>
<td><input id="file_001" type="checkbox" /></td>
<td class="">Somefile.jpg</td>
</tr>
<tr>
<td><input id="file_002" type="checkbox" /></td>
<td>Somefile2.jpg</td>
</tr>
<tr>
<td><input id="file_003" type="checkbox" /></td>
<td>Somefile3.jpg</td>
</tr>
<tr>
<td><input id="file_004" type="checkbox" /></td>
<td>Somefile4.jpg</td>
<tr>
<td><input id="file_005" type="checkbox" /></td>
<td>Somefile5.jpg</td>
</tr>
</tbody>
</table>

table.myselectable tr {
```

The following JQuery code can be used to set uf the table:
```JS
$(document).ready(function(){
var tabel = new SelecTable($('table.my-selectable')[0],
{allCheckbox: "all_checkbox"});
});
```




Add the following CSS to your table rows:

```CSS
table.my-selectable tr {
user-select: none; /* CSS3 (little to no support) */
-ms-user-select: none; /* IE 10+ */
-moz-user-select: none; /* Gecko (Firefox) */
-webkit-user-select: none; /* Webkit (Safari, Chrome) */
}
```

0 comments on commit 26572bb

Please sign in to comment.