This time I will share jQuery Plugin and tutorial about Gmail-style Table Rows Selection With Checkboxes – jQuery Selectr, hope it will help you in programming stack.
Selectr is a jQuery plugin that enables you to select/unselect multiple table rows with checkboxes. Inspired by Google Gmail.
When applying this jQuery plugin to a table, a column is appended to each row allowing the user to check or uncheck a certain number of rows by click.
All the ids of the checked rows are stored in a jQuery data object that is easy to access by any jQuery function.
More features:
- Custom styles for highlighted rows.
- Right/left positions.
- Limits the number of checkable rows.
- Displays a counter for checked rows.
- Allows to set pre-check rows.
- Tri-state checkbox.
How to use it:
1. Load the latest version of the jQuery Selectr plugin after jQuery library.
2 |
integrity = "sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" |
3 |
crossorigin = "anonymous" > |
5 |
< script src = "jquery.selectr.js" ></ script > |
2. Just call the function selectr()
on the target HTML table and done.
01 |
< table id = "table-demo" > |
17 |
< td >The Empire Strikes Back</ td > |
22 |
< td >Return of the Jedi</ td > |
1 |
$( '#table-demo' ).selectr(); |
3. Customize the background color of the checked table row(s).
1 |
$( '#table-demo' ).selectr({ |
2 |
highlight : "highlighted" |
4. Set the position of the checkboxes.
1 |
$( '#table-demo' ).selectr({ |
5. Create a counter to display the count of checked rows. You need to create a tfoot
in your HTML table in order to display the counter.
1 |
$( '#table-demo' ).selectr({ |
6. Set the maximum number of table rows to be checkable.
1 |
$( '#table-demo' ).selectr({ |
7. Set the pre-checked table rows.
1 |
$( '#table-demo' ).selectr({ |
8. More default configuration options.
01 |
$( '#table-demo' ).selectr({ |
03 |
selectrCount : "selectrCount" , |
04 |
highlight : "highlighted" , |
08 |
checkedList : "checkedList" , |
09 |
lastChecked: "lastChecked" , |
10 |
lastCheckedState: "lastCheckedState" , |
11 |
callbackType: "immediate" , |
This awesome jQuery plugin is developed by Neofyt. For more Advanced Usages, please check the demo page or visit the official website.