Revision: f17fecd9afbf
Author: Pekka Klärck
Date: Tue Aug 21 06:43:22 2012
Log: Log/report: Sort statistics by name so that original order is
restored.
Update issue 1199
Now it is possible to restore original sorting order by sorting stats by
tag or suite name. Sorting again by name just reverses the order.
http://code.google.com/p/robotframework/source/detail?r=f17fecd9afbf
Modified:
/src/robot/htmldata/rebot/log.html
/src/robot/htmldata/rebot/report.html
/src/robot/htmldata/rebot/view.js
=======================================
--- /src/robot/htmldata/rebot/log.html Tue Aug 21 05:46:27 2012
+++ /src/robot/htmldata/rebot/log.html Tue Aug 21 06:43:22 2012
@@ -126,7 +126,7 @@
</script>
<script type="text/x-jquery-tmpl" id="totalStatisticsRowTemplate">
- <tr>
+ <tr class="row-${$item.index}">
<td class="col_stat_name">
<div class="stat_name">
<span>{{html label}}</span>
@@ -137,7 +137,7 @@
</script>
<script type="text/x-jquery-tmpl" id="tagStatisticsRowTemplate">
- <tr>
+ <tr class="row-${$item.index}">
<td class="col_stat_name">
<div class="stat_name">
<span title="{{html doc}}">{{html label}}</span>
@@ -155,7 +155,7 @@
</script>
<script type="text/x-jquery-tmpl" id="suiteStatisticsRowTemplate">
- <tr onclick="makeElementVisible('${id}')">
+ <tr onclick="makeElementVisible('${id}')" class="row-${$item.index}">
<td class="col_stat_name">
<div class="stat_name">
<a title="{{html label}}"
=======================================
--- /src/robot/htmldata/rebot/report.html Tue Aug 21 05:46:27 2012
+++ /src/robot/htmldata/rebot/report.html Tue Aug 21 06:43:22 2012
@@ -325,7 +325,7 @@
</script>
<script type="text/x-jquery-tmpl" id="totalStatisticsRowTemplate">
- <tr onclick="totalDetailSelected('${type}')">
+ <tr onclick="totalDetailSelected('${type}')" class="row-${$item.index}">
<td class="col_stat_name">
<div class="stat_name">
<a href="#total_${type}">{{html label}}</a>
@@ -336,7 +336,7 @@
</script>
<script type="text/x-jquery-tmpl" id="tagStatisticsRowTemplate">
- <tr onclick="tagDetailSelected('${label}');">
+ <tr onclick="tagDetailSelected('${label}');" class="row-${$item.index}">
<td class="col_stat_name">
<div class="stat_name">
<a href="#tag_${label}"
@@ -355,7 +355,7 @@
</script>
<script type="text/x-jquery-tmpl" id="suiteStatisticsRowTemplate">
- <tr onclick="suiteDetailSelected('${id}');">
+ <tr onclick="suiteDetailSelected('${id}');" class="row-${$item.index}">
<td class="col_stat_name">
<div class="stat_name">
<a href="#suite_${id}"
=======================================
--- /src/robot/htmldata/rebot/view.js Tue Aug 21 05:46:27 2012
+++ /src/robot/htmldata/rebot/view.js Tue Aug 21 06:43:22 2012
@@ -100,7 +100,20 @@
}
function enableStatisticsSorter() {
- $(".statistics").tablesorter({headers: {5: {sorter: false}}});
+ $.tablesorter.addParser({
+ id: 'statName',
+ type: 'numeric',
+ is: function(s) {
+ return false; // do not auto-detect
+ },
+ format: function(string, table, cell, cellIndex) {
+ var index = $(cell).parent().attr('class').substring(4);
+ return parseInt(index);
+ }
+ });
+ $(".statistics").tablesorter({
+ headers: {0: {sorter:'statName'}, 5: {sorter: false}}
+ });
}
function addStatTable(tableName) {
@@ -130,7 +143,7 @@
var locator = '#' + tableName + '_stats > tbody';
// Need explicit for loop because $.tmpl() does not handle very large
lists
for (var i = 0; stats !== undefined && i < stats.length; i++) {
- $.tmpl(templateName , stats[i]).appendTo($(locator));
+ $.tmpl(templateName , stats[i], {index: i}).appendTo($(locator));
}
}