cosmetic
[unfold.git] / plugins / hazelnut / static / js / hazelnut.js
index 81cf1e2..ae253d0 100644 (file)
@@ -8,7 +8,7 @@
 
     // TEMP
     var debug=false;
-    debug=true
+//    debug=true
 
     var Hazelnut = Plugin.extend({
 
             // Prefix id with plugin_uuid
             result += "<input";
             result += " class='hazelnut-checkbox'";
-            result += " id='" + this.id('checkbox', this.id_from_key(key, value)) + "'";
+            result += " id='" + this.flat_id(this.id('checkbox', value)) + "'";
             result += " name='" + key + "'";
             result += " type='checkbox'";
             result += " autocomplete='off'";
     
            // adding an array in one call is *much* more efficient
            // this.table.fnAddData(line);
-           this.buffered_lines.push(line)
+           this.buffered_lines.push(line);
 
         },
 
             }
 
 
-            var checkbox_id = this.id('checkbox', this.id_from_key(this.key, key_value));
-            checkbox_id = '#' + checkbox_id.replace(/\./g, '\\.');
-
+            var checkbox_id = this.flat_id(this.id('checkbox', key_value));
+            checkbox_id = '#' + checkbox_id;
             var element = $(checkbox_id, this.table.fnGetNodes());
-
+           if (debug) messages.debug("set_checkbox checked=" + checked + " id=" + checkbox_id + " matches=" + element.length);
             element.attr('checked', checked);
         },
 
         {
             if (this.received_all_query) {
                // if the 'all' query has been dealt with already we may turn on the checkbox
+               if (debug) messages.debug("turning on checkbox for record "+record[this.key]);
                 this.set_checkbox(record, true);
            } else {
                // otherwise we need to remember that and do it later on
+               if (debug) messages.debug ("Remembering record to check " + record[this.key]);
                 this.buffered_records_to_check.push(record);
-               console.log ("Remembering record to check " + record);
            }
         },
 
 
                 /* ... and check the ones specified in the resource list */
                 $.each(this.buffered_records_to_check, function(i, record) {
+                   if (debug) messages.debug ("delayed turning on checkbox " + i + " record= " + record);
                     self.set_checkbox(record, true);
                 });