-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export selected rows from button action #4824
Conversation
@@ -42,6 +42,7 @@ | |||
$: { | |||
rowSelectionStore.actions.updateSelection( | |||
$component.id, | |||
selectedRows.length ? selectedRows[0].tableId : "", |
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.
Setting the table id here, this seems to be fine because the store gets reset when the data provider above it gets changed. Still unsure of why this is the case, but it does.
Codecov Report
@@ Coverage Diff @@
## develop #4824 +/- ##
===========================================
- Coverage 69.51% 69.23% -0.28%
===========================================
Files 145 145
Lines 4979 5003 +24
Branches 765 766 +1
===========================================
+ Hits 3461 3464 +3
- Misses 1066 1086 +20
- Partials 452 453 +1
Continue to review full report at Codecov.
|
@PClmnt this is awesome and critical for business users when building reports |
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.
LGTM! Nice work 🚀 Also really cool the way you can do this directly through the budibase API now.
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.
Nice one Peter! This looks good and will be really useful 👍
The only issue I can see is around configuring the action. By fetching selected rows by table ID, having 2 table components referencing the same table will now overwrite each other. I think it's also a bit confusing that this isn't linked to the table components (where you actually do the row selection).
I would suggest:
- Update the button action so that you select a table component, not a backend table
- Don't store
tableId
in the selection store, just fetch the selected rows by table component ID - When executing the action. determine the
tableId
by looking at the selected rows - Update the button action to be more clear that it's linked to table components, and not just a generic data export action
runtimeBinding: `${safeState}.${makePropSafe(table._id)}`, | ||
runtimeBinding: `${safeState}.${makePropSafe(table._id)}.${makePropSafe( | ||
"selectedRows" | ||
)}`, |
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.
This is a breaking change for existing apps but we haven't released the row selection feature yet so this should be fine. More of just an FYI for the future!
Description
Previously users had no way to export data from their application.
This PR allows the user to create a button action, select a table that they would to export rows from and export those rows when their created button is clicked.
This works for both internal and external tables.
n.b I had to slightly modify the row selection store and client table component to store the Table ID, for use in the exportRows API call. The table ID is needed for output processing etc. I've therefore updated dataBinding.js to take account of this, it still will only output the selected row IDs