-
Notifications
You must be signed in to change notification settings - Fork 32
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
TablePlugin needs to know current grid selection, table name #2093
Comments
Thanks for creating the issue @mofojed. For context, I use a table plugin to add custom menu items when right clicking on a row or selection of rows. Use cases: Table nameUsed for filtering menu items depending on which table is being interacted with. E.g. if we're on the "addresses" table, we can add a menu item to "send a letter", without showing this menu item on all tables Iris grid stateUsed for applying a menu action to multiple rows. E.g. a table full of orders, I can select rows 0-10 and when I click "cancel order" (a custom menu item), the plugin can get those 10 rows and run a command on each one |
@alexbassy for the second case, it would make sense for the |
One potential pitfall of the 2nd item is that tables could rearrange their rows or the user could have sorted/filtered causing the range to not match the underlying table if you're just trying to use row indices. Consider a ticking table with The safest way to do this would include adding your own key column to the table, setting that column to always be fetched (by default we only fetch the columns on screen plus a buffer window), and then using that column value to figure out what rows you're operating on. Even if the table is append only, a user could sort by a column and the row index would not match the original table. |
I should clarify the pitfall is mostly if you talk to the server at all. If you're keeping this all on the client, then it should mostly be fine. The row number can still be changed out from under you on the client if a table is sorted such that new data ticks in at the top. That is why you would want to use some key info about the row rather than row number to identify the rows. |
@AkshatJawne just add the removed |
Closes #2093 (For now, will reopen ticket after merge for better solution to handle deprecated `panel` prop)
Merged in fix, but as described in PR, reopening ticket in order to look at more long-term solutions. |
Closes #2093 (For now, will reopen ticket after merge for better solution to handle deprecated `panel` prop)
As a developer of a TablePlugin, I would like to be able to get the table name and the current selection state from within my plugin.
Previously we could do this with the
panel
prop that was passed in before it was removed: #1982Could use
panel.getTableName()
to get the table name andpanel.irisGrid.current.state
to get the selected range of rows. Would like to still be able to do that.The text was updated successfully, but these errors were encountered: