[TIMOB-98] Support non-standard data in TableViews and GroupedViews
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:51:58.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 0.7.0 |
Components | iOS |
Labels | n/a |
Reporter | Nolan Wright |
Assignee | Blain Hamon |
Created | 2011-04-15T02:23:37.000+0000 |
Updated | 2011-04-17T01:51:58.000+0000 |
Description
Allow a developer to pass additional attributes into the TableView/GroupedView JSON data object, then ensure that these attributes are available in the event data of the click event. Here's an example
var data = [
{title:'foo', name:'George'},
{title:'foo', name:'Fred'}
];
var a = Titanium.UI.createTableView({data:data}, function(e)
{
e.rowData.name // should be name attribute for clicked row based on above JSON object
}
Things like title and name are to be expected. What about properties that aren't normally stored or functions and the like?
Implementation wise, there's three ways to implement this:
1) data is recreated from the used properties and passed in. This is what's currently done.
2) the native side keeps a copy of the entire parsed dictionary of data, to use it as a copy when needed. This has the advantage of being portable from context to context, but functions and other non-JSON properties will be lost.
3) the javascript side keeps a reference to the data, and passes in that reference. It does allow for non-JSON properties, but is limited to the context where that data was first created
Style 3 is already being done by way of needing to do callbacks, so that's what's done.
(from [6645e55f57b28215fc90817cf7b88ba3d714ba3d]) RESOLVED #98 http://github.com/appcelerator/titanium_mobile/commit/6645e55f57b28215fc90817cf7b88ba3d714ba3d"> http://github.com/appcelerator/titanium_mobile/commit/6645e55f57b28...