var TableLoader new Class include Options Options image null image_plu

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var TableLoader = new Class({
include: Options,
Options: {
image: null,
image_plus: "/images/plus.gif",
image_minus: "/images/minus.gif",
href: null,
ajax_rows_selector: null
},
initialize: function(options) {
this.setOptions(options);
},
toggle: function(){
if (! defined(this.ajax_rows)) {
Xhr.load(this.options.href, { method: 'get' });
this.ajax_rows = true;
this.options.image.src = this.options.image_minus;
return
}
this.options.image.src =
this.options.image.src.endsWith(this.options.image_minus) ? this.options.image_plus : this.options.image_minus;
$$(this.options.ajax_rows_selector).each('toggle');
}
});