This repository was archived by the owner on Aug 29, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 72
- force value change on 'enter', not just lost focus #52
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
001f40d
- force value change on 'enter', not just lost focus
4d5e749
fix issue 50 + new test for the issue
b18402d
fix pylint
1f3f97b
revert data
9eb7c50
pylint fix
8da1dc4
Merge remote-tracking branch 'origin/master' into 3.0-issue50-enter-i…
8f34a48
Merge branch 'master' into 3.0-issue50-enter-in-last-row
Marc-Andre-Rivet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,7 @@ | ||
| import DashTable from 'cypress/DashTable'; | ||
| import DOM from 'cypress/DOM'; | ||
| import Key from 'cypress/Key'; | ||
| import Resolve from 'cypress/Resolve'; | ||
|
|
||
| describe('dash basic', () => { | ||
| beforeEach(() => { | ||
|
|
@@ -12,4 +15,17 @@ describe('dash basic', () => { | |
| cy.get('button.next-page').click(); | ||
| DashTable.getCell(0, 0).within(() => cy.get('input').should('have.value', '250')); | ||
| }); | ||
|
|
||
| // https://github.com/plotly/dash-table/issues/50 | ||
| it('can edit last and update dataframe on "enter"', async () => { | ||
| DashTable.getCell(249, 0).click(); | ||
|
|
||
| const initialValue = await Resolve(DOM.focused.then($input => { | ||
| return $input.val(); | ||
| })); | ||
|
|
||
| DOM.focused.type(`abc${Key.Enter}`); | ||
|
|
||
| cy.get('#container').should('have.value', `[249][0] = ${initialValue} -> abc${initialValue}`); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The BE will update the container field if 'Enter' triggered the df update as it should be. |
||
| }); | ||
| }); | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,7 @@ | |
| ) | ||
| ) | ||
| module_names = ['dash_table'] | ||
| modules = [__import__(x) for x in module_names] | ||
| modules = [__import__(module) for module in module_names] | ||
| dash_table = modules[0] | ||
|
|
||
| url = ( | ||
|
|
@@ -85,5 +85,30 @@ def updateDataframe(virtualization_settings): | |
| return df[start_index:end_index] | ||
|
|
||
|
|
||
| @app.callback( | ||
| Output('container', 'children'), | ||
| [ | ||
| Input('table', 'dataframe'), | ||
| Input('table', 'dataframe_previous') | ||
| ] | ||
| ) | ||
| def findModifiedValue(dataframe, previous): | ||
| modification = 'None' | ||
|
|
||
| if dataframe is None or previous is None: | ||
| return modification | ||
|
|
||
| for (y, row) in enumerate(dataframe): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't need the () when unpacking. |
||
| row_prev = previous[y] | ||
|
|
||
| for (x, col) in enumerate(row): | ||
| if col != row_prev[x]: | ||
| modification = '[{}][{}] = {} -> {}'.format( | ||
| y, x, row_prev[x], col | ||
| ) | ||
|
|
||
| return modification | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| app.run_server(port=8081, debug=False) | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Easy switch to Typescript