aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableContent.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPTableContent.m')
-rw-r--r--Source/SPTableContent.m12
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 7afbfe84..e0af1d54 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -338,6 +338,7 @@
#endif
NSArray *columnNames;
NSDictionary *columnDefinition;
+ NSMutableDictionary *preservedColumnWidths = nil;
NSTableColumn *theCol;
#ifndef SP_REFACTOR
NSTableColumn *filterCol;
@@ -374,6 +375,12 @@
if ([selectedTable isEqualToString:newTableName]) {
previousTableRowsCount = tableRowsCount;
+ // Store the column widths for later restoration
+ preservedColumnWidths = [NSMutableDictionary dictionaryWithCapacity:[[tableContentView tableColumns] count]];
+ for (NSTableColumn *eachColumn in [tableContentView tableColumns]) {
+ [preservedColumnWidths setObject:[NSNumber numberWithFloat:[eachColumn width]] forKey:[[eachColumn headerCell] stringValue]];
+ }
+
// Otherwise store the newly selected table name and reset the data
} else {
if (selectedTable) [selectedTable release], selectedTable = nil;
@@ -533,6 +540,11 @@
]];
[theCol setEditable:YES];
+ // Copy in the width if present in a reloaded table
+ if ([preservedColumnWidths objectForKey:[columnDefinition objectForKey:@"name"]]) {
+ [theCol setWidth:[[preservedColumnWidths objectForKey:[columnDefinition objectForKey:@"name"]] floatValue]];
+ }
+
#ifndef SP_REFACTOR
// Set up column for filterTable
filterCol = [[NSTableColumn alloc] initWithIdentifier:[columnDefinition objectForKey:@"datacolumnindex"]];