From 9dce9c57b4ff9928c6b3f3edd3af3eab0a3c1cae Mon Sep 17 00:00:00 2001 From: Duy Nguyen Date: Mon, 6 May 2024 17:08:44 -0400 Subject: [PATCH 1/3] Expose row selection attributes --- jdaviz/components/plugin_table.vue | 3 +++ jdaviz/core/template_mixin.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/jdaviz/components/plugin_table.vue b/jdaviz/components/plugin_table.vue index 5d3fe56f52..333ba61f34 100644 --- a/jdaviz/components/plugin_table.vue +++ b/jdaviz/components/plugin_table.vue @@ -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" > diff --git a/jdaviz/core/template_mixin.py b/jdaviz/core/template_mixin.py index 4c91451656..89f33830b7 100644 --- a/jdaviz/core/template_mixin.py +++ b/jdaviz/core/template_mixin.py @@ -4361,6 +4361,9 @@ class Table(PluginSubcomponent): headers_visible = List([]).tag(sync=True) # list of strings headers_avail = List([]).tag(sync=True) # list of strings items = List().tag(sync=True) # list of dictionaries, pass single dict to add_row + 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 From 87a8dc66cc3dd3253083b8b593bce84f27116ebc Mon Sep 17 00:00:00 2001 From: Duy Nguyen Date: Mon, 6 May 2024 17:21:01 -0400 Subject: [PATCH 2/3] Changelog --- CHANGES.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 2d291f6c0e..ae9cb773dd 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -82,6 +82,8 @@ Specviz2d API Changes ----------- +- Plugin Table components now support row selection. [#2856] + Cubeviz ^^^^^^^ From c6e12d4a5d0f5072fb9f54226bb6301326840f7a Mon Sep 17 00:00:00 2001 From: Duy Nguyen Date: Tue, 7 May 2024 11:05:57 -0400 Subject: [PATCH 3/3] Add test coverage reminder note --- jdaviz/core/template_mixin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jdaviz/core/template_mixin.py b/jdaviz/core/template_mixin.py index 89f33830b7..cbf03d75c1 100644 --- a/jdaviz/core/template_mixin.py +++ b/jdaviz/core/template_mixin.py @@ -4361,6 +4361,9 @@ class Table(PluginSubcomponent): headers_visible = List([]).tag(sync=True) # list of strings 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. 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