Skip to content
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

wxGUI/dbmgr: fix sorting newly added column values #2436

Merged
merged 1 commit into from
Sep 13, 2023
Merged
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
13 changes: 11 additions & 2 deletions gui/wxpython/dbmgr/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,18 +556,19 @@ def OnColumnMenu(self, event):
def OnColumnSort(self, event):
"""Column heading left mouse button -> sorting"""
self._col = event.GetColumn()

self._updateColSortFlag()
self.ColumnSort()

event.Skip()

def OnColumnSortAsc(self, event):
"""Sort values of selected column (ascending)"""
self._updateColSortFlag()
self.SortListItems(col=self._col, ascending=True)
event.Skip()

def OnColumnSortDesc(self, event):
"""Sort values of selected column (descending)"""
self._updateColSortFlag()
self.SortListItems(col=self._col, ascending=False)
event.Skip()

Expand Down Expand Up @@ -714,6 +715,14 @@ def IsEmpty(self):

return True

def _updateColSortFlag(self):
"""
Update listmix.ColumnSorterMixin class self._colSortFlag list
private variable for new column which was added (required for
sorting new added column values)
"""
self._colSortFlag.extend([0] * (len(self.columns) - len(self._colSortFlag)))


class DbMgrBase:
def __init__(
Expand Down
Loading