Skip to content

Commit

Permalink
test: 常规可编辑表格、嵌套多层可编辑表格
Browse files Browse the repository at this point in the history
  • Loading branch information
CNFeffery committed Dec 24, 2024
1 parent d7abda9 commit acc4cad
Showing 1 changed file with 115 additions and 0 deletions.
115 changes: 115 additions & 0 deletions tests/dataDisplay/AntdTable/fix_nested_editable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
if True:
import sys

sys.path.append('../../../')
import dash
from dash import html
from datetime import datetime
import feffery_antd_components as fac
from feffery_dash_utils.style_utils import style

app = dash.Dash(__name__)

normal_table = fac.AntdTable(
columns=[
{
'title': 'int型示例',
'dataIndex': 'int型示例',
'editable': True,
'width': '20%',
},
{
'title': 'float型示例',
'dataIndex': 'float型示例',
'editable': True,
'width': '20%',
},
{
'title': 'str型示例',
'dataIndex': 'str型示例',
'editable': True,
'width': '20%',
},
{
'title': '日期时间示例',
'dataIndex': '日期时间示例',
'editable': True,
'width': '20%',
},
{
'title': 'placeholder示例',
'dataIndex': 'placeholder示例',
'editable': True,
'width': '20%',
'editOptions': {'placeholder': '请输入内容'},
},
],
data=[
{
'int型示例': 123,
'float型示例': 1.23,
'str型示例': '示例字符',
'日期时间示例': datetime.now().strftime(
'%Y-%m-%d %H:%M:%S'
),
}
]
* 3,
bordered=True,
)

nested_table = fac.AntdTable(
id='table-click-event-demo',
columns=[
{
'title': f'Column {i}',
'dataIndex': f'column-{i}',
'width': 'calc(100% / 3)',
'editable': True,
}
for i in range(1, 4)
],
data=[
{
'key': f'row-{i}',
'column-1': '第一层',
'column-2': '第一层',
'column-3': '第一层',
'children': [
{
'key': f'row-{i}{j}',
'column-1': '第二层',
'column-2': '第二层',
'column-3': '第二层',
'children': [
{
'key': f'row-{i}{j}{k}',
'column-1': '第二层',
'column-2': '第二层',
'column-3': '第二层',
}
for k in range(3)
],
}
for j in range(3)
],
}
for i in range(3)
],
bordered=True,
)

app.layout = html.Div(
[
fac.AntdSpace(
[normal_table, nested_table],
direction='vertical',
style=style(width='100%'),
)
],
style=style(padding=50),
)


if __name__ == '__main__':
app.run(debug=True)

0 comments on commit acc4cad

Please sign in to comment.