Commit 37efef02 authored by HERBERT Ryan's avatar HERBERT Ryan

sample_set * add basic pagination

parent 50bf2dbd
......@@ -158,7 +158,14 @@ def all():
else :
type = 'generic'
list = SampleSetList(type)
step = None
page = None
is_not_filtered = "sort" not in request.vars and "filter" not in request.vars
if request.vars['page'] is not None and is_not_filtered:
page = int(request.vars['page'])
step = 50
list = SampleSetList(type, page, step)
list.load_creator_names()
list.load_sample_information()
list.load_config_information()
......@@ -192,7 +199,9 @@ def all():
fields = fields,
type = type,
isAdmin = isAdmin,
reverse = False)
reverse = False,
step = step,
page = page)
## return form to create new generic sample_set
......
class SampleSetList():
def __init__(self, type):
def __init__(self, type, page=None, step=None):
self.type = type
limitby = None
if page is not None and step is not None:
limitby = (page*step, (page+1)*step+1) # one more element to indicate if another page exists
query_gss = db(
(auth.vidjil_accessible_query(PermissionEnum.read.value, db[type]))
).select(
db[type].ALL,
limitby = limitby,
orderby = ~db[type].id
)
......
......@@ -10,6 +10,16 @@
search
<input id="db_filter_input" type="text" value="{{=request.vars["filter"]}}" onchange="db.call('sample_set/all', {'type': '{{=type}}', 'filter' : this.value} )">
</div>
<div class="db_block_right">
page:
{{ if page > 0: }}
<div class="button" onclick="db.call('sample_set/all', {'type': '{{=type}}', 'page': {{=page-1}}})"><</div>
{{ pass }}
{{= page + 1 }}
{{if len(query) > step : }}
<div class="button" onclick="db.call('sample_set/all', {'type': '{{=type}}', 'page': {{=page+1}}})">></div>
{{ pass }}
</div>
</div>
<div id="db_table_container">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment