Skip to content

Commit

Permalink
wxGUI/dbmgr: fix sorting newly added column values (#2436)
Browse files Browse the repository at this point in the history
By left mouse click on the column or right mouse click invoked
column menu items for sorting.
  • Loading branch information
tmszi committed Sep 13, 2023
1 parent f36656a commit b5d3873
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions gui/wxpython/dbmgr/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,18 +560,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 @@ -718,6 +719,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

0 comments on commit b5d3873

Please sign in to comment.