+ wxDataViewModel * model = GetOwner()->GetModel();
+
+ if(nmHDR->iButton == 0)
+ {
+ wxDataViewColumn *col = GetColumn(idx);
+ if(col->IsSortable())
+ {
+ if(model && model->GetSortingColumn() == idx)
+ {
+ bool order = col->IsSortOrderAscending();
+ col->SetSortOrder(!order);
+ model->SetSortOrderAscending(!order);
+ }
+ else if(model)
+ {
+ model->SetSortingColumn(idx);
+ model->SetSortOrderAscending(true);
+ }
+ }
+ UpdateDisplay();
+ if(model)
+ model->Resort();
+ }
+