2016-11-09 10 views
0

誰がどのように代わりにテーブルの下に垂直スクロールバージャンゴ - tables2

Page 1 of 2 Next 25 of 49 vehicles

を持つのdjango-tables2に垂直スクロールバーを追加する方法を教えてもらえます。

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> 

私はすべての上に見てきたが、私はストレートを得るように見えることはできません答え、または配列とチェックボックスを表示するために使用できるより良いテーブルモジュールがありますか?

答えて

0

同じボートの誰でも私はそれを理解しました。

私はその後、私は個人的にI、テーブル全体のインターフェイスにスクロールバーを追加し、その後

<div style="width: 125px; height: 500px; overflow-y: scroll;"> 
     {% render_table veh_list %} 
</div> 

HTMLテンプレートに<div><div>をテーブルを包ん

RequestConfig(request, pagination=False).configure(veh_list)

無効に改ページを回しましたヘッダーを常にトップに保つのが好きだったでしょうが、これが私が思いつく最高の解決策です。