Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/357.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python django-tables2:将滚动条添加到表中_Python_Css_Django_Python 2.7_Django Tables2 - Fatal编程技术网

Python django-tables2:将滚动条添加到表中

Python django-tables2:将滚动条添加到表中,python,css,django,python-2.7,django-tables2,Python,Css,Django,Python 2.7,Django Tables2,我使用django-tables2创建了一个表: class MyTable(tables.Table): class Meta: model = TestModel attrs = {"class": "paleblue"} 在这个表中,我注意到当任何给定单元格包含太多字符时,列宽将自动扩展。这有时会扩展到浏览器的可查看区域之外。我试图通过修改django-tables2提供的默认screen.css文件来添加滚动条(添加了overflow:scrol

我使用django-tables2创建了一个表:

class MyTable(tables.Table):
    class Meta:
        model = TestModel
        attrs = {"class": "paleblue"}
在这个表中,我注意到当任何给定单元格包含太多字符时,列宽将自动扩展。这有时会扩展到浏览器的可查看区域之外。我试图通过修改django-tables2提供的默认
screen.css
文件来添加滚动条(添加了
overflow:scroll
):

虽然这会添加滚动条,但滚动条的右侧会随表格一起展开。因此,我无法看到滚动条的右半部分。此外,滚动条没有显示为“活动”,因为没有可单击的“条”


在django-tables2表中实现滚动条的正确方法是什么?

经过反复试验,我找到了解决方案。我不得不修改django-tables2的默认
screen.css
文件中的以下条目:

div.table-container {
    display: inline-block;
    position:relative;
    overflow:auto;
}
我希望这个解决方案对其他人有帮助

div.table-container {
    display: inline-block;
    position:relative;
    overflow:auto;
}