- // XXX urn should be replaced by the key
- // XXX we should enforce that both queries have the same key !!
- checkbox_id = "#hazelnut-checkbox-" + this.options.plugin_uuid + "-" + unfold.escape_id(record[ELEMENT_KEY].replace(/\\/g, ''))
- $(checkbox_id, this.table.fnGetNodes()).attr('checked', true);
+ /* Default: checked = true */
+ if (typeof checked === 'undefined')
+ checked = true;
+
+ var key_value;
+ /* The function accepts both records and their key */
+ switch (manifold.get_type(record)) {
+ case TYPE_VALUE:
+ key_value = record;
+ break;
+ case TYPE_RECORD:
+ /* XXX Test the key before ? */
+ key_value = record[this.key];
+ break;
+ default:
+ throw "Not implemented";
+ break;
+ }
+
+
+ var checkbox_id = this.id('checkbox', this.id_from_key(this.key, key_value));
+ checkbox_id = '#' + checkbox_id.replace(/\./g, '\\.');
+
+ var element = $(checkbox_id, this.table.fnGetNodes());
+
+ element.attr('checked', checked);