Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-98] Support non-standard data in TableViews and GroupedViews

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:51:58.000+0000
Affected Version/sn/a
Fix Version/sRelease 0.7.0
ComponentsiOS
Labelsn/a
ReporterNolan Wright
AssigneeBlain Hamon
Created2011-04-15T02:23:37.000+0000
Updated2011-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
}

Comments

  1. Blain Hamon 2011-04-15

    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

  2. Blain Hamon 2011-04-15

    Style 3 is already being done by way of needing to do callbacks, so that's what's done.

  3. Jeff Haynie 2011-04-15

    (from [6645e55f57b28215fc90817cf7b88ba3d714ba3d]) RESOLVED #98 http://github.com/appcelerator/titanium_mobile/commit/6645e55f57b28215fc90817cf7b88ba3d714ba3d"> http://github.com/appcelerator/titanium_mobile/commit/6645e55f57b28...

JSON Source