Reloading a ListCtrl with ColumnSorterMixin

I'm using ColumnSorterMixin to allow users to sort by column in a ListCtrl. In this app, users can reload the control by a button. The problem is that the mixin doesn't notice the reload -- the up/down arrow stays on the column that was last sorted, and clicking the column again causes it to reverse the sort direction.

It doesn't look as though there's any method to "tell" ColumnSorterMixin that the reload has happened, and that it should return to a "neutral state". I'll probably add that capability, but I first wanted to check whether anyone else has encountered this, or whether I've missed something.

···

--
Don Dwiggins
Advanced Publishing Technology

Don Dwiggins wrote:

I'm using ColumnSorterMixin to allow users to sort by column in a ListCtrl. In this app, users can reload the control by a button. The problem is that the mixin doesn't notice the reload -- the up/down arrow stays on the column that was last sorted, and clicking the column again causes it to reverse the sort direction.

It doesn't look as though there's any method to "tell" ColumnSorterMixin that the reload has happened, and that it should return to a "neutral state". I'll probably add that capability, but I first wanted to check whether anyone else has encountered this, or whether I've missed something.

Send me a patch when you are done.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hi Don,

Don Dwiggins wrote:

I'm using ColumnSorterMixin to allow users to sort by column in a ListCtrl. In this app, users can reload the control by a button. The problem is that the mixin doesn't notice the reload -- the up/down arrow stays on the column that was last sorted, and clicking the column again causes it to reverse the sort direction.

It doesn't look as though there's any method to "tell" ColumnSorterMixin that the reload has happened, and that it should return to a "neutral state". I'll probably add that capability, but I first wanted to check whether anyone else has encountered this, or whether I've missed something.

There is a SortListItems Method in the mixin, but you need to call it after you reloaded the list.

Werner