0
誰能告訴我如何將垂直滾動條添加到django-tables2
,而不必垂直滾動條的Django tables2
Page 1 of 2 Next 25 of 49 vehicles
在表的底部。
tables.py
'''
Created on 28 Oct 2016
@author: JXA8341
'''
import django_tables2 as tables
from .models import Vehicle
class CheckBoxColumnWithName(tables.CheckBoxColumn):
@property
def header(self):
return self.verbose_name
class VehicleTable(tables.Table):
update = tables.CheckBoxColumn(accessor="pk",
attrs = { "th__input":{"onclick": "toggle(this)"}},
orderable=False)
class Meta:
model = Vehicle
fields = ('update', 'vehid')
# Add class="paleblue" to <table> tag
attrs = {'class':'paleblue'}
screen.css
table.paleblue + ul.pagination {
font: normal 11px/14px 'Lucida Grande', Verdana, Helvetica, Arial, sans- serif;
overflow: scroll;
margin: 0;
padding: 10px;
border: 1px solid #DDD;
list-style: none;
}
div.table-container {
display: inline-block;
position:relative;
overflow:auto;
}
table.html
<div class='vehlist'>
<script language="JavaScript">
function toggle(source) {
checkboxes = document.getElementsByName('update');
for(var i in checkboxes)
checkboxes[i].checked = source.checked;
}
</script>
<form action="/loadlocndb/" method="POST" enctype="multipart/form-data">
{% csrf_token %}
{% render_table veh_list %}
<h4> Location database .csv file</h4>
{{ form.locndb }}
<input type="submit" value="Submit" />
</form>
</div>
我看了所有的地方,但我似乎無法獲得直答案,還是有更好的表模塊,我可以用來顯示數組和複選框?