Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Enable Row Selection on Plugin Table Component #2856

Merged
merged 3 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ Specviz2d
API Changes
-----------

- Plugin Table components now support row selection. [#2856]

Comment on lines +85 to +86
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this isn't actually used anywhere, it might not need a changelog entry?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entirely up to y'all, just need the instruction and I can remove it!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since people can use this downstream, let's keep it.

Cubeviz
^^^^^^^

Expand Down
3 changes: 3 additions & 0 deletions jdaviz/components/plugin_table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
dense
:headers="headers_visible_sorted.map(item => {return {'text': item, 'value': item}})"
:items="items"
:item-key="item_key"
:show-select="show_rowselect"
v-model="selected_rows"
class="elevation-1 width-100"
></v-data-table>
</v-row>
Expand Down
6 changes: 6 additions & 0 deletions jdaviz/core/template_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4362,6 +4362,12 @@ class Table(PluginSubcomponent):
headers_avail = List([]).tag(sync=True) # list of strings
items = List().tag(sync=True) # list of dictionaries, pass single dict to add_row

# NOTE: These UI features are not covered in test coverage. Plugins making use of
# this feature should ensure test coverage for their respective tables.
Comment on lines +4365 to +4366
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a note regarding test coverage here. Thanks!

show_rowselect = Bool(False).tag(sync=True) # Flag to enable row selection boxes
item_key = Unicode().tag(sync=True) # Unique field to identify row for selection
selected_rows = List().tag(sync=True) # List of selected rows

def __init__(self, plugin, name='table', *args, **kwargs):
self._qtable = None
self._table_name = name
Expand Down