Skip to content

Commit 75677c8

Browse files
committed
Added page selector to stream table
1 parent 0f54556 commit 75677c8

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

components/emo/js/emo_runs_streamer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function MakeRunsTable(div, url, templatediv, counterdiv){
108108
prev_text: '← Previous',
109109
//container_class: '.users-pagination',
110110
//ul_class: '.larger-pagination',
111-
per_page_select: false,
111+
//per_page_select: true,
112112
per_page_opts: [50, 100, 500],
113113
//per_page_class: '.select-box',
114114
per_page: 100,

components/js/stream_table.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,15 @@
8383
return this.has_sorting ? this.getIndex().length : this.getData().length;
8484
}
8585

86+
_F.initJumpToPage = function(opts){
87+
//this.pageopts = $.extend({jumptopage_container: "pagejump"}, opts);
88+
var html = "<form id='stream_jumptopage'><strong>Jump to page: </strong><input style='width:35px' name='page' id='jumptopage' type='number' min='1'>&nbsp;<input type='submit' class='btn btn-default btn-tiny' value='Submit'></form>";
89+
$(".pagejump").html(html);
90+
this.$jumptopage = $(".pagejump form");
91+
};
92+
8693
_F.initPagination = function(opts){
94+
this.initJumpToPage(opts);
8795
this.paging_opts = $.extend({
8896
span: 5,
8997
prev_text: '&laquo;',
@@ -133,6 +141,21 @@
133141
});
134142
}
135143

144+
_self.$jumptopage.on('submit', function(e){
145+
e.preventDefault();
146+
var values = $(this).serializeArray();
147+
console.log(values);
148+
var page = parseInt(values[0]['value']);
149+
if(page<1 || page>_self.pageCount())
150+
return;
151+
var current_page = _self.paginate(page);
152+
if (current_page >= 0) {
153+
$('.active', _self.$pagination).removeClass('active');
154+
$('li[data-page='+ current_page +']',
155+
_self.$pagination).addClass('active');
156+
}
157+
return false;
158+
});
136159
_self.$pagination.on('click', 'a', function(e){
137160
var $this = $(this), page = parseInt($this.text()), current_page;
138161

runs/templates/runs/runs_new.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@
8484
<div class="col-sm-12 col-xs-12" id="table_window"
8585
style="padding:5px;height:100%;">
8686
<div class="row" style="margin:0;padding:0">
87-
<div class="col-xs-12 col-sm-6" style="margin-top:20px;margin-bottom:20px;padding:0"><input type="text" name="search" placeholder="Search..." id="tablesearch"/></div>
88-
<div class="col-xs-12 col-sm-6" style="padding:0">
89-
<div class="pull-right paginat" style="margin:0"></div>
87+
<div class="col-xs-12 col-sm-4" style="margin-top:20px;margin-bottom:20px;padding:0"><input type="text" name="search" placeholder="Search..." id="tablesearch"/></div>
88+
<div class="col-xs-12 col-sm-8" style="padding:0;display:inline-block">
89+
<div class="pagejump" style="height:75px;padding-top:22px;float:left"></div>
90+
<div class="paginat" style="margin:0;margin-left:5px;float:left"></div>
9091
</div>
9192
</div>
9293
<table class="table table-bordered" id="runstable" style="background-color:white;table-layout: fixed;word-wrap:break-word;overflow-y:hidden">

0 commit comments

Comments
 (0)