Skip to content

Commit

Permalink
Merge branch 'main' into relax_structure_information
Browse files Browse the repository at this point in the history
  • Loading branch information
AndresOrtegaGuerrero authored Jan 7, 2025
2 parents 9de1775 + 72911d9 commit cef967a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,7 @@ def _generate_table(self, structure):
def _change_selection(self, _):
selected_indices = self.atom_coordinates_table.selected_rows
self.widget.displayed_selection = selected_indices

def _update_table_selection(self, change):
selected_indices = change.new
self.atom_coordinates_table.selected_rows = selected_indices
14 changes: 14 additions & 0 deletions src/aiidalab_qe/common/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,20 @@ class TableWidget(anywidget.AnyWidget):
drawTable();
model.on("change:data", drawTable);
model.on("change:selected_rows", (e) => {
const newSelection = model.get("selected_rows");
// Update row selection based on selected_rows
const rows = domElement.querySelectorAll('tr');
rows.forEach((row, index) => {
if (index > 0) {
if (newSelection.includes(index - 1)) {
row.classList.add('selected-row');
} else {
row.classList.remove('selected-row');
}
}
});
});
el.appendChild(domElement);
}
export default { render };
Expand Down

0 comments on commit cef967a

Please sign in to comment.