#15160 closed defect (fixed)

generic wxDataViewCtrl sort columns get out of sync

Reported by: dconnet Owned by:
Priority: normal Milestone:
Component: GUI-generic Version: stable-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: yes

Description

The generic version uses a global static to track the last sort column. Doing the following will cause an improper sort to occur:

pDVC is a wxDataViewCtrl
wxDataViewColumn* pCol = pDVC->GetSortingColumn();
pCol->UnsetAsSortKey();
pDVC->Freeze();
<delete all items, all new items>
pDVC->Thaw();
<<<

On thawing, the control will perform a sort. But the internal index did not get updated so it sorts based on the last column.

There are 2 issues:

  • m_sortingColumnIdx is not updated when a column changes sort via UnsetAsSortKey
  • g_column isn't properly updated in wxDataViewMainWindow::SortPrepare when the window is frozen.

Attachments (1)

dvc.patch download (2.4 KB) - added by dconnet 18 months ago.

Download all attachments as: .zip

Change History (3)

Changed 18 months ago by dconnet

comment:1 Changed 18 months ago by dconnet

  • Patch set

comment:2 Changed 18 months ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

(In [73834]) Reset sorting column in generic wxDataViewCtrl properly.

We could keep using the column previously used for sorting even after
UnsetAsSortKey() was called on it. Ensure that this doesn't happen by
resetting the owner wxDataViewCtrl sort column index too.

Closes #15160.

Note: See TracTickets for help on using tickets.