Hello! I need help with PageEvent.
@router.get('/add/delivery', response_model=FastUI, response_model_exclude_none=True)
async def deliveriy_choice(
session: AsyncSession = Depends(get_async_session)
):
filters = DeliveryFilter()
deliveries = await Delivery.get_by(session, filters)
"""I need id from column 'id' """
return page(
c.Heading(text='Add', level=2),
c.Paragraph(text='DB'),
c.Table(
data_model=DeliveryTable,
data=deliveries,
columns=[
DisplayLookup(
field='id', on_click=PageEvent(
name='server-load',
context={'id': '{id}'}
)
),
DisplayLookup(field='create_at', mode='date'),
DisplayLookup(field='shop', mode='auto')
]
),
c.Div(
components=[
c.ServerLoad(
path='/mission/delivery/dynamic-content/{id}',
load_trigger=PageEvent(name='server-load'),
components=[c.Text(text='before')],
), ],
class_name='py-2',
)
)
@router.get('/delivery/dynamic-content/{id}', response_model=FastUI, response_model_exclude_none=True)
async def modal_view(
session: AsyncSession = Depends(get_async_session),
id: str | None = None
) -> list[AnyComponent]:
"I need id here"
print(id)
# delivery = await Delivery.get_by(session, filters=DeliveryFilter(id=id))
await asyncio.sleep(0.5)
return [
c.Paragraph(text=f'Good'),
]