#6235·nicegui

在构建后设置 `table.pagination` 会对行进行分页,但会隐藏分页控件

作者: evnchn创建于 2026年8月3日更新于 2026年8月23日
标签bug
  • Reported by Claude on behalf of @evnchn. TL;DR:

Both tables above paginate to 5 rows. Only table A gets a pagination bar. Table B shows 5 of its 20 rows with no controls to reach the other 15 — the constructor derives hide-pagination from the pagination argument, but the property setter never updates it. There is a workaround (t.props('hide-pagination=false')), so this is surprising rather than fatal.

Cause The constructor derives a second prop — nicegui/elements/table.py:75-76 on 3.15.0: Python self._props['hide-pagination'] = pagination is None self._props['pagination'] = pagination if isinstance(pagination, dict) else {'rowsPerPage': pagination or 0} The setter writes only pagination, leaving hide-pagination untouched, and does not apply the int{'rowsPerPage': n} normalisation either (table.py:396-397): Python @pagination.setter def pagination(self, value: dict) -> None: self._props['pagination'] = value A table built without pagination starts at hide-pagination = True, and nothing ever clears it. Measured in a real browser (Chromium via Playwright, nicegui 3.15.0 from PyPI) 20 rows, rowsPerPage = 5, counting tbody tr and testing .q-table__bottom for visibility: | build path | body rows rendered | pagination bar visible | --- | --- | --- | ui.table(rows=rows, pagination=5) | 5 | True | t = ui.table(rows=rows); t.pagination = {'rowsPerPage': 5} | 5 | False | then t.props('hide-pagination=false') | 5 | True (workaround) | The example above also prints this on startup, so the divergence is checkable without a browser: A {'pagination': {'rowsPerPage': 5}, 'hide-pagination': False} B {'pagination': {'rowsPerPage': 5}, 'hide-pagination': True} A screenshot of the two tables side by side is available if useful. Scope of the sweep this came from Found by comparing, for every ui.* element, the state produced by ui.X(param=v) against ui.X(); x.param = v. 42 constructor …

内容来源: zauberzeug/nicegui