Fix error when sorting Job list by object.
[ganeti_webmgr.git] / ganeti_web / static / js / jquery.multi_checkbox_selector.js
blob3f1171f7cc4f5e9f9b2c4757ade5998b8dda3e35
1 (function( $ ){
2     $.fn.select_all = function() {
3     /* Multicheckbox selector */
5         var form = this;
6         //If checkboxes are 0 then do not show at all
7         if (this.find('input[type=checkbox]').size() > 0) {
9             var selectorbox = $("<input>")
10                 .attr(
11                 {
12                     type:  'checkbox',
13                     checked:    false,
14                     id: 'checkboxsel'
15                 })
16                 .click(function()
17                 {
18                     var checked_status = this.checked;
19                     form.find("input[type=checkbox]").each(function()
20                     {
21                         this.checked = checked_status;
22                     });
23                 });
24             var selectorlabel =  $("<label>")
25                 .attr({
26                     "for":  'checkboxsel'
27                 })
28                 .text("Select All: ");
30             selectorlabel.insertBefore(form);
31             selectorbox.insertBefore(form);
32         }
33     }
35 })( jQuery );