propertyKey as keyPath? (1)


#1

Can my propertyKey be a key path? I am getting:

PortfolioTile is not key value coding-compliant for the key "tile.lastPrice"

SDataGridColumn* symbolColumn = [[SDataGridColumn alloc] initWithTitle:@"Price" forProperty:@"tile.lastPrice"];

#2

Hi Jimjon,

The DataGrid doesn’t currently support key paths, it just supports the accessing of the properties on the base “data-object”. We’ve had this issue raised before and we are planning to add it at some point in the future. Until then, a neat workaround would be to create an object specifically for the format of the data grid (one property per column on your grid).

@ interface GridDataObjectPortfolioTile : NSObject

@property id tileLastPrice
...

@end

Then you could simply create a set of these GridDataObjectPortfolioTile objects, populate them with the data you need from your PortfolioTile objects, and then supply these new objects to your grid instead. I know it isn’t a perfect solution but it means that you don’t have to change your current data structure.

Hope the above helps,
Jan