Skip to content

Commit

Permalink
wxGUI/dbmgr: fix sorting newly added column values
Browse files Browse the repository at this point in the history
By left mouse click on the col or right mouse click invoked
col menu items for sorting.
  • Loading branch information
tmszi committed Jun 14, 2022
1 parent 1e0f888 commit 95aef2b
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 95aef2b

Please sign in to comment.