|
02-10-08 / 23:07 : Cappuccino TableView / datasource / pagination (cjed) | Among CPView available for now in Cappuccino we find : CPClipView, CPCollectionView, CPControl, CPFlashView (!), CPProgressIndicator, CPScrollView, CPShadowView, CPTabView, NSCustomView, NSView, _CPWindowView.
There isn't yeat any equivalent to NSTableView, NSOutlineView or NSBrowser, but the Cappuccino team is working on the implementation of a CPTableView :
"The CPTableView is still under development, it's already in the repository if you want to have a look. After this is finished i think the cappuccino team or someone else will pickup the work on CPBrowser."
It seems hard work due to these components complexity :
"CPTableView : needs all of NSTableView and supporting classes. We’re
not going to be using NSCell’s though, so we’ll also need to make some
decisions on exactly what to do here, at least when straight up NSView
replacement isn’t enough."
However that team still managed to write about 20 000 lines of code for Cappuccino's AppKit and FoundationKit.
Meanwhile they advice using a CPCollectionView (and CPCollectionViewItem), but then we have no column headers no rearrange feature (no column move nor resizing).
Once these hierarchical models display components are available, the Nib2Nic team will be able to manage the appropriate conversion, with the important (and impacting) difference that CPTableView shouldn't rely on Cell classes.
Usually enterprise applications rely on paginated table components in order to limit the requested data size (in a cursor way). With Cocoa TableView are included in a ScrollView, and only visible rows (at the current position, that is the current position of the vertical scroller) are loaded (requested to the datasource object). Then while scrolling, the datasource provides the additional rows only, never the whole table data (except when they all fit in the visible area).
Cocoa indeed dispatchs the rows on multiple pages when preparing the component for printing.
When the CPTableView will be available in Cappuccino, we will just need to implement the - (id)tableView:(CPTableView *)aTableView objectValueForTableColumn:(CPTableColumn *)aTableColumn row:(int)rowIndex datasource object's method. It will typically trigger a JSONP request to the server in order to retreive values for that cell. We will probably prefer maintaining a cache to avoid making a database request for only such a cell. In fact in that case the TableView model with scrollable view won't look appropriate (a tableView: objectsArrayForTableColumn: page: method would be better). Moreover, if we want to manage sorting (with ascending or descending order) - what is easily done in Cocoa -, we won't be able to consider the columns separately, and the datasource method will have to look like this (will return a cells values matrix) : tableView: objectsMatrix: forPage: sortingColumn: ascendingOrder:. | | Comments | Write a comment | |
|