aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbamse16 <marius@marius.me.uk>2009-03-23 12:45:56 +0000
committerbamse16 <marius@marius.me.uk>2009-03-23 12:45:56 +0000
commit3d58dc8578c5a48e254f3ffa2394ed875c83a60e (patch)
tree67c904ae99a61665adb4cf367b7019cba4c12dd0
parenta6003a92fc507924f439cd69050cb44e349e0e29 (diff)
downloadsequelpro-3d58dc8578c5a48e254f3ffa2394ed875c83a60e.tar.gz
sequelpro-3d58dc8578c5a48e254f3ffa2394ed875c83a60e.tar.bz2
sequelpro-3d58dc8578c5a48e254f3ffa2394ed875c83a60e.zip
Issue 194: reload table list deselects tables
-rw-r--r--Source/TablesList.m14
1 files changed, 13 insertions, 1 deletions
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];
+ }
}
/*