Skip to content

0.2.2 — DataTable group headers and row events

Choose a tag to compare

@israel-dryer israel-dryer released this 06 Aug 20:17
· 336 commits to main since this release

Changed

  • On a read-only DataTable, the second press of a double-click no longer repeats the first press's action. Because the double-click event is now bound on every table rather than only on editable ones, the second press is delivered as a double-click instead of as another single click. Two visible consequences, both of which bring read-only tables in line with how editable ones have always behaved: double-clicking a column heading now advances the sort once rather than twice, so it flips direction where it previously came back to where it started; and with selection_mode="multi" and selection controls shown, double-clicking a row now leaves it toggled rather than back in its original state. (#417)

  • A double-click also runs your on_row_click handler twice — once before on_row_double_click and once after. That has always been true of the click event: a double-click is reported on the second press while a row click is reported on release, so the order is click, double-click, click. What is new is that pairing the two handlers on one table is worth doing at all, since on_row_double_click never fired on a read-only table before. Single click selects, double click opens is now the natural thing to write — so if the double delivery matters for your handler, keep the work in on_row_click idempotent, or move it to the double-click handler. (#417)

Fixed

  • Double-clicking a DataTable row now fires on_row_double_click. The binding behind the event was installed only when the table was also built with allow_edit=True, so on a read-only table — the common case — the event had nothing behind it and the handler never ran, while on_row_click and on_row_right_click on the same table kept working. That is what made it look like the event itself was broken rather than absent. The event is public API and does not depend on editing, so it is now bound unconditionally; allow_edit still controls only whether the built-in edit dialog opens alongside it. (#417)

  • A group header in a grouped DataTable no longer fires row events carrying an empty record. A group header is not a row and carries no record, but on_row_double_click and on_row_right_click only checked that some tree item was under the pointer, so clicking one emitted a RowEvent whose record was {} and whose id was None — enough to raise KeyError inside a handler doing the documented e.record["name"]. The right-click half needed no unusual setup, since right-click menus are on by default, so any grouped table was affected; the double-click half also opened a spurious New Record dialog when the table was built with allow_edit=True. A group header also stopped being recorded as the row menu's target, which could leave a later menu command pointed at a row that carries no record. on_row_click has always ignored group headers; both of the others now match it. (#418, #420)

  • An expanded DataTable group header now shows the correct chevron. Expanding a group with the keyboard, or by double-clicking its header, left the group open while its chevron still pointed at collapsed, so the arrow and the group disagreed until something else repainted the row. Collapsing was never affected. The chevron is now read after the new state has settled rather than during the change, which also covers the keyboard path that has been wrong since grouped tables gained custom chevrons. (#419)

  • Clicking a DataTable group header, or any row on a table showing selection checkboxes, now leaves the keyboard pointed at that row. Ordinary row clicks were never affected. In those two cases the click toggled the row but did not give the table keyboard focus, so the arrow keys did not continue from what had just been clicked, and a following Space or arrow key did nothing to the table at all. With selection checkboxes that applied to every row, leaving Tab as the only way to start driving the table from the keyboard. (#421)

  • A column separator can be dragged again on a DataTable showing selection checkboxes. Dragging one moved nothing at all there, so those columns could not be resized. The click handling that makes a plain click toggle a row was also stopping clicks that landed between two columns rather than on a row, and that press is what begins the resize drag. It now stops only the clicks it actually handles. (#421)

What's Changed

Full Changelog: v0.2.1...v0.2.2