简体   繁体   English

什么是最简单/正确的为什么要更改django_tables2表的宽度

[英]What is the easiest/correct why to change the width of django_tables2 table

I want a table rendered by django-tables2 to be drawn over the whole screen. 我希望在整个屏幕上绘制django-tables2渲染的表。 I'm using the included paleblue css. 我正在使用随附的淡蓝色CSS。

class PoolTable(tables.Table):
    class Meta:
        model = Simple 
        attrs = {'class': 'paleblue','width':'100%'}
  • Is it possible to do this fairly easy in the code and if so how? 是否可以在代码中相当容易地做到这一点?
  • If you can't easily do this in the code, what must I change in the css or html or any other place? 如果您无法在代码中轻松完成此操作,则必须在CSS或HTML或任何其他位置中进行哪些更改?

This is more of a css question. 这更多是一个CSS问题。 Here is how I did it the easy way: 这是我最简单的方法:

chang the width to be over 100% 更改宽度超过100%

class PoolTable(tables.Table):
    class Meta:
        model = Simple 
        attrs = {'class': 'paleblue','width':'200%'}

This will only change the size of the table not the pagination. 这只会更改表的大小,而不会更改分页。 If you wont to change the its size you have to change it in the css. 如果您不想更改其大小,则必须在CSS中进行更改。 I did find it easiest to just remove the borders from the pagination. 我确实发现仅从分页中删除边框是最容易的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM