This repository was archived by the owner on Aug 29, 2025. It is now read-only.
Repository navigation
Conversation
To fix the bug reported in plotly#917 tooltip_conditional filter cause "TypeError: Can not read property of undefined" exception when client side pagination is enabled
Author
|
Aha, just realized there is already a pending PR https://github.com/plotly/dash-table/pull/906/files which include a better fix. So withdraw my PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is to fix the bug reported in #917 tooltip_conditional filter cause "TypeError: Can not read property of undefined" exception when client side pagination is enabled.
When pagination is enabled, the virtualized.data array only contains rows in the current pages, but the row value passed to this function is the index relative to the whole table.
To give a concrete example, suppose the page size = 4, and the whole table has 10 rows, and we are on the second page. Then virtualized.data will be a array of length 4 and contains the rows of the 2nd page; virtualized.indices=[4, 5, 6, 7]; virtualized.offset.rows=0 (assuming not using virtualization mode). When we move the cursor over the first row in that page, the callback will be invoked with row=4. The line in question will result in trying to access virtualized.data[4], which caused the exception.
The fix instead looks up the virtualized.indices list to convert the row to the correct index relative to current page.
Actually, the bug can also manifest when filtering is on.