X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Flists%2Fstatic%2Fjs%2Fsimplelist.js;fp=plugins%2Flists%2Fstatic%2Fjs%2Fsimplelist.js;h=254fb22635964456e35718848d4348ecbc0a3708;hb=91dec1137db6f3b461ab40542f06b5fa93a2efa5;hp=2bed5b438bcbf547c061bbe16a4b243184dd4b71;hpb=5401c1b857fae502f5b49ce869ea943d8607e2bf;p=myslice.git diff --git a/plugins/lists/static/js/simplelist.js b/plugins/lists/static/js/simplelist.js index 2bed5b43..254fb226 100644 --- a/plugins/lists/static/js/simplelist.js +++ b/plugins/lists/static/js/simplelist.js @@ -12,6 +12,7 @@ var SimpleList = Plugin.extend ({ init: function (options, element) { + this.classname=options.classname; this._super (options, element); this.buffered_records=[]; this.listen_query(options.query_uuid); @@ -37,12 +38,11 @@ var self=this; var $plugindiv = this.elmt(); var options = this.options; - var classname=options.classname; // locate the element; with datatables in the way, // this might not be a direct son of the div-plugin - var $table = $plugindiv.find("table."+classname).first(); + var $table = $plugindiv.find("table."+this.classname).first(); // also we may or may not have a header - var $tbody = $table.find("tbody."+classname).first(); + var $tbody = $table.find("tbody."+this.classname).first(); var use_datatables = $table.hasClass("with-datatables"); var rows=self.buffered_records; self.buffered_records=[]; @@ -69,7 +69,7 @@ if (use_datatables) this._datatables_update_table($table, $tbody, rows, options.key); else - this._regular_update_table($table, $tbody, rows, options.key, classname); + this._regular_update_table($table, $tbody, rows, options.key, this.classname); }, _regular_set_message: function ($table, $tbody, message) { @@ -78,7 +78,8 @@ _regular_update_table: function ($table, $tbody, rows, key, classname) { if (debug) - messages.debug('regular_update_table ' + rows.length + " rows" + " key=" + key + " classname=" + classname); + messages.debug('regular_update_table ' + rows.length + " rows" + + " key=" + key + " classname=" + this.classname); var self=this; var html=$.map(rows, function (row) { var value = row; @@ -91,10 +92,10 @@ }); if ($.isArray(value)) { return $.map(value, function(val, i) { - return self._html_row ( self._cell (key, val), classname); + return self._html_row ( self._cell (key, val), this.classname); }); } else { - return self._html_row ( self._cell (key, value), classname); + return self._html_row ( self._cell (key, value), this.classname); } }).join(); $tbody.html(html);