Skip to content
Discussion options

You must be logged in to vote

The crash is because you're reimplementing DataTable's own header branch (self.ordered_columns[column_index]) in your override, and hitting it with a column index that isn't a real column. You don't need to touch that path at all. Add a plain on_click on your subclass instead of overriding _on_click, and let the built-in one keep running.

Two facts that make this easy:

  • Click events carry a chain attribute. event.chain == 2 is a double-click.
  • The cell under the pointer is in event.style.meta as row/column. The header row is row == -1.

And the bit that isn't obvious: your subclass on_click and the built-in DataTable._on_click are on different classes in the MRO, so both fire. That means s…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@willmcgugan
Comment options

@nannerpusser
Comment options

Comment options

You must be logged in to vote
1 reply
@nannerpusser
Comment options

Answer selected by nannerpusser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants