From 3d58dc8578c5a48e254f3ffa2394ed875c83a60e Mon Sep 17 00:00:00 2001 From: bamse16 Date: Mon, 23 Mar 2009 12:45:56 +0000 Subject: Issue 194: reload table list deselects tables --- Source/TablesList.m | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Source/TablesList.m b/Source/TablesList.m index afe60a25..1f33d5ab 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -46,6 +46,13 @@ loads all table names in array tables and reload the tableView NSArray *resultRow; int i; BOOL containsViews = NO; + NSString *selectedTable = nil; + NSInteger selectedRowIndex; + + selectedRowIndex = [tablesListView selectedRow]; + if(selectedRowIndex > 0 && [tables count]){ + selectedTable = [NSString stringWithString:[tables objectAtIndex:selectedRowIndex]]; + } [tablesListView deselectAll:self]; [tables removeAllObjects]; @@ -89,7 +96,12 @@ loads all table names in array tables and reload the tableView // Notify listeners that the query has finished [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self]; - [tablesListView reloadData]; + [tablesListView reloadData]; + + //if the previous selected table still exists, select it + if( selectedTable != nil && [tables indexOfObject:selectedTable] < [tables count]) { + [tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:[tables indexOfObject:selectedTable]] byExtendingSelection:NO]; + } } /* -- cgit v1.2.3