metrics: don't sort on columns where all elements are same

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2015-10-29 12:45:04 +05:30
parent c02dc40dd9
commit ca42ed29b8
1 changed files with 11 additions and 0 deletions

View File

@ -154,11 +154,22 @@
return $(this).index() == columnIndex;
});
var hasAllRowsSameValue = true;
var firstElem = $($elems[0]).html();
var sortData = [];
$elems.each(function() {
if (hasAllRowsSameValue) {
if (firstElem !== $(this).html()) {
hasAllRowsSameValue = false;
}
}
sortData.push($(this));
});
if (hasAllRowsSameValue) {
return;
}
var stringComparator = function(a,b) {
return a.html().localeCompare(b.html());
};