mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
Fixed: The data views were not loaded immediately
When reloading the table view, the actual loading (-load) is defered until layout is needed (generally in the next run loop). This is an advantage because it minimize reloads but in some case it is necessary to force a reload, for example when we need to access data views, or manually edit a view, or when we explicitely ask for a reload. This commit adds _reloadDataViewsImmediately and make use of it when necessary. Tests: AppKit/CPTableViewTest -> -testEditCell
This commit is contained in:
+13
-2
@@ -565,7 +565,7 @@ NOT YET IMPLEMENTED
|
||||
- (void)reloadDataForRowIndexes:(CPIndexSet)rowIndexes columnIndexes:(CPIndexSet)columnIndexes
|
||||
{
|
||||
if ([self _numberOfRowsDidChange])
|
||||
[self _reloadDataViews];
|
||||
[self _reloadDataViewsImmediately];
|
||||
else
|
||||
[self _enumerateViewsInRows:rowIndexes columns:columnIndexes usingBlock:function(view, row, column, stop)
|
||||
{
|
||||
@@ -603,6 +603,13 @@ NOT YET IMPLEMENTED
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
// reload data views and process events to force a -load
|
||||
- (void)_reloadDataViewsImmediately
|
||||
{
|
||||
[self _reloadDataViews];
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
}
|
||||
|
||||
//Target-action Behavior
|
||||
/*!
|
||||
Sets the message sent to the target when the user double-clicks an
|
||||
@@ -3470,12 +3477,13 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
[columnIndexes enumerateIndexesUsingBlock:function(columnIndex, stopCol)
|
||||
{
|
||||
var tableColumn = _tableColumns[columnIndex],
|
||||
tableColumnUID = [tableColumn UID],
|
||||
dataView = [self _preparedViewAtColumn:columnIndex row:row isRowSelected:isRowSelected];
|
||||
|
||||
if ([dataView superview] !== self)
|
||||
[self addSubview:dataView];
|
||||
|
||||
dataViewsForRow[[tableColumn UID]] = dataView;
|
||||
dataViewsForRow[tableColumnUID] = dataView;
|
||||
}];
|
||||
}];
|
||||
}
|
||||
@@ -3706,6 +3714,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
|
||||
- (void)enumerateAvailableViewsUsingBlock:(Function/*CPView *dataView, CPInteger row, CPInteger column*, @ref stop*/)handler
|
||||
{
|
||||
[self _reloadDataViewsImmediately];
|
||||
[self _enumerateViewsInRows:_exposedRows columns:_exposedColumns usingBlock:handler];
|
||||
}
|
||||
|
||||
@@ -5129,6 +5138,8 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
if (![self isRowSelected:rowIndex])
|
||||
[[CPException exceptionWithName:@"Error" reason:@"Attempt to edit row " + rowIndex + " when not selected." userInfo:nil] raise];
|
||||
|
||||
[self _reloadDataViewsImmediately];
|
||||
|
||||
[self scrollRowToVisible:rowIndex];
|
||||
[self scrollColumnToVisible:columnIndex];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user