0.2.2 — DataTable group headers and row events
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 withselection_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_clickhandler twice — once beforeon_row_double_clickand 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, sinceon_row_double_clicknever 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 inon_row_clickidempotent, or move it to the double-click handler. (#417)
Fixed
-
Double-clicking a
DataTablerow now fireson_row_double_click. The binding behind the event was installed only when the table was also built withallow_edit=True, so on a read-only table — the common case — the event had nothing behind it and the handler never ran, whileon_row_clickandon_row_right_clickon 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_editstill controls only whether the built-in edit dialog opens alongside it. (#417) -
A group header in a grouped
DataTableno longer fires row events carrying an empty record. A group header is not a row and carries no record, buton_row_double_clickandon_row_right_clickonly checked that some tree item was under the pointer, so clicking one emitted aRowEventwhoserecordwas{}and whoseidwasNone— enough to raiseKeyErrorinside a handler doing the documentede.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 withallow_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_clickhas always ignored group headers; both of the others now match it. (#418, #420) -
An expanded
DataTablegroup 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
DataTablegroup 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
DataTableshowing 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
- docs(events): drop the phantom custom-event section and correct the guard description (#409) by @israel-dryer in #414
- fix(datatable): row events on read-only and grouped tables (#417, #418, #419, #420) by @israel-dryer in #423
- fix(datatable): a handled click now takes keyboard focus, and stops only what it handles (#421) by @israel-dryer in #424
Full Changelog: v0.2.1...v0.2.2