Skip to content

Commit

Permalink
Fix a tough bug in DataGroup.js about paging.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuol committed Jan 28, 2016
1 parent 1d3343f commit 430d283
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
Expand Up @@ -118,10 +118,10 @@ RowsGroup.prototype = {
})
var iColumn = previousOrder.indexOf(orderingColumn);
if (iColumn >= 0) {
// assume change the direction, because we already has that in previos order
// assume change the direction, because we already has that in previous order
return [[orderingColumn, this._toogleDirection(this.order[iColumn][1])]]
} // else This is the new ordering column. Proceed as is.
} // else got milti order - work normal
} // else got multi order - work normal
return order;
},

Expand Down Expand Up @@ -179,7 +179,7 @@ RowsGroup.prototype = {
currentOrder = this._getInjectedMonoSelectWorkaround(currentOrder);
this.order = this._getOrderWithGroupColumns(currentOrder)
// this.table.order($.extend(true, Array(), this.order)) // disable this line in order to support sorting on non-grouped columns
this.table.draw()
this.table.draw(false)
},
};

Expand Down
Expand Up @@ -102,9 +102,10 @@ $(document).ready(function() {
array.push(app_clone);
}
}

var data = {"applications": array}
$.get("/static/historypage-template.html", function(template) {
historySummary.append(Mustache.render($(template).filter("#history-summary-template").html(),data));
$.get("/static/historypage-template.html", function(template) {
historySummary.append(Mustache.render($(template).filter("#history-summary-template").html(),data));
var selector = "#history-summary-table";
var conf = {
"columns": [
Expand All @@ -117,7 +118,6 @@ $(document).ready(function() {
{name: 'seventh'},
{name: 'eighth'},
],
"displayLength": 20,
};

var rowGroupConf = {
Expand All @@ -135,10 +135,6 @@ $(document).ready(function() {
}
}

if ($(selector.concat(" tr")).length <= 20) {
$.extend(conf, {paging: false});
}

if (!hasMultipleAttempts) {
var attemptIDCells = document.getElementsByClassName("attemptIDSpan");
for (i = 0; i < attemptIDCells.length; i++) {
Expand All @@ -152,8 +148,11 @@ $(document).ready(function() {
durationCells[i].innerHTML = formatDuration(timeInMilliseconds);
}

$(selector).DataTable(conf);
if ($(selector.concat(" tr")).length < 20) {
$.extend(conf, {paging: false});
}

$(selector).DataTable(conf);
$('#hisotry-summary [data-toggle="tooltip"]').tooltip();
});
});
Expand Down
Expand Up @@ -36,14 +36,15 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("")
val providerConfig = parent.getProviderConfig()
val content =
<div class="row-fluid">
<script src={UIUtils.prependBaseUri("/static/dataTables.rowsGroup.js")}></script>
<div class="span12">
<ul class="unstyled">
{providerConfig.map { case (k, v) => <li><strong>{k}:</strong> {v}</li> }}
</ul>
{
if (allAppsSize > 0) {
<div id="history-summary" class="span12"></div>
<script src={UIUtils.prependBaseUri("/static/dataTables.rowsGroup.js")}></script> ++
<div id="history-summary" class="span12"></div> ++
<script src={UIUtils.prependBaseUri("/static/historypage.js")}> </script>
} else if (requestedIncomplete) {
<h4>No incomplete applications found!</h4>
} else {
Expand All @@ -67,8 +68,6 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("")
}
</a>
</div>
<script src={UIUtils.prependBaseUri("/static/historypage.js")}> </script>

</div>
UIUtils.basicSparkPage(content, "History Server")
}
Expand Down

0 comments on commit 430d283

Please sign in to comment.