From c5d5b115cae8eb5f8295365ffa463a6561b9cccb Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Wed, 15 Sep 2010 12:21:13 +0000 Subject: Enable column sorting in the server processes window. Implements issue #816. --- Interfaces/English.lproj/DatabaseProcessList.xib | 42 +++++++++++++++++++++++- Source/SPProcessListController.m | 14 ++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/Interfaces/English.lproj/DatabaseProcessList.xib b/Interfaces/English.lproj/DatabaseProcessList.xib index 13688b15..656f5910 100644 --- a/Interfaces/English.lproj/DatabaseProcessList.xib +++ b/Interfaces/English.lproj/DatabaseProcessList.xib @@ -12,7 +12,7 @@ YES - + YES @@ -134,6 +134,11 @@ 3 YES + + Id + YES + compare: + User @@ -160,6 +165,11 @@ 3 YES + + User + YES + compare: + Host @@ -199,6 +209,11 @@ 3 YES + + Host + YES + compare: + db @@ -225,6 +240,11 @@ 3 YES + + db + YES + compare: + Command @@ -251,6 +271,11 @@ 3 YES + + Command + YES + compare: + Time @@ -277,6 +302,11 @@ 3 YES + + Time + YES + compare: + State @@ -303,6 +333,11 @@ 3 YES + + State + YES + compare: + Info @@ -329,6 +364,11 @@ 3 YES + + Info + YES + compare: + 3 diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m index afb13634..886e6f2b 100644 --- a/Source/SPProcessListController.m +++ b/Source/SPProcessListController.m @@ -469,6 +469,16 @@ return (![object isNSNull]) ? object : [prefs stringForKey:SPNullValue]; } +/** + * Table view delegate method. Called when the user changes the sort by column. + */ +- (void)tableView:(NSTableView *)tableView sortDescriptorsDidChange:(NSArray *)oldDescriptors +{ + [processesFiltered sortUsingDescriptors:[tableView sortDescriptors]]; + + [tableView reloadData]; +} + #pragma mark - #pragma mark Text field delegate methods @@ -537,6 +547,10 @@ [self _updateServerProcessesFilterForFilterString:[filterProcessesSearchField stringValue]]; } + // Reset sort descriptors + [processesFiltered sortUsingDescriptors:[processListTableView sortDescriptors]]; + + // Reload data [processListTableView reloadData]; // Enable controls -- cgit v1.2.3