Skip to content

Commit

Permalink
Start the display with the current job
Browse files Browse the repository at this point in the history
  • Loading branch information
mitiao committed May 25, 2018
1 parent 2274e52 commit 14fcf37
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion assets/javascripts/job_next_previous.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ function setupJobNextPrevious() {
},
{targets: 2, render: renderBuild},
{targets: 3, render: renderFinishTime},
]
],
initComplete: function (settings, json) {
// Seems an issue in case of displayStart is not an integer multiple of the pageLength
// Caculate and start the page with current job
var current_index = json.data.map(function(n) {return n.iscurrent;}).indexOf(1);
var page = Math.min(Math.max(0, Math.floor(current_index / table.page.len())), table.page.info().pages);
table.page(page).draw('page');
}
});
$('#job_next_previous_table').on('draw.dt', function (){
setupLazyLoadingFailedSteps();
Expand Down

0 comments on commit 14fcf37

Please sign in to comment.