【发布时间】:2022-11-04 15:10:53
【问题描述】:
我正在尝试将 Ag Grid 高度的样式设置为 100%,但表格未显示。 我尝试使用视口和像素,它们工作得非常好。宽度,百分比也可以正常工作。
我想要做的是将 Aggrid 表高度适合父 Div。我仍在学习 JustPy 和 python,所以这个问题可能是关于样式的基础知识。
import justpy as jp
grid_options = """
{
defaultColDef: {
filter: true,
sortable: true,
resizable: true,
cellStyle: {textAlign: 'center'},
headerClass: 'font-bold'
},
columnDefs: [
{headerName: "Make", field: "make"},
{headerName: "Model", field: "model"},
{headerName: "Price", field: "price"}
],
rowData: [
{make: "Toyota", model: "Celica", price: 35000},
{make: "Ford", model: "Mondeo", price: 32000},
{make: "Porsche", model: "Boxter", price: 72000}
]
}
"""
def grid_test5():
wp = jp.QuasarPage()
c1 = jp.Div(a=wp, classes='q-pa-sm')
grid = jp.AgGrid(a=c1, options=grid_options, style='height: 100%; width: 100%; margin: 0.25em')
return wp
jp.justpy(grid_test5)
【问题讨论】: