JS: fix multiselect burning resources

Especially on browsers with slow JS like IE8 iterating again and again
over all rows used to harm response rendering. Immagine a dasboard with
a total of a few hundred rows refreshing every 10 seconds while taking
3 secs to render one dashlet... it's far better right now.

refs #6417
This commit is contained in:
Thomas Gelf 2014-06-05 15:16:03 +00:00
parent 72a2ec41ba
commit ca6b373be2
4 changed files with 8 additions and 17 deletions

View File

@ -38,3 +38,11 @@ table.historycolorgrid a {
table.historycolorgrid a:hover {
text-decoration: none;
}
table.multiselect tr[href] td {
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}

View File

@ -28,7 +28,6 @@
this.applyGlobalDefaults();
this.applyHandlers($('#layout'));
this.icinga.ui.prepareContainers();
this.icinga.ui.prepareMultiselectTables($(document));
},
// TODO: What's this?

View File

@ -412,9 +412,6 @@
this.icinga.ui.initializeTriStates($resp);
// Make multiselection-tables not selectable.
this.icinga.ui.prepareMultiselectTables($resp);
// Replace images with sparklines.
$resp.find('img.inlinepie').each(function(){
self.icinga.ui.initializeSparklines($(this));

View File

@ -276,19 +276,6 @@
*/
},
/**
* Prepare all multiselectable tables for multi-selection by
* removing the regular text selection.
*/
prepareMultiselectTables: function () {
var $rows = $('table.multiselect tr[href]');
$rows.find('td').attr('unselectable', 'on')
.css('user-select', 'none')
.css('-webkit-user-select', 'none')
.css('-moz-user-select', 'none')
.css('-ms-user-select', 'none');
},
/**
* Add the given table-row to the selection of the closest
* table and deselect all other rows of the closest table.