Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12] API - Titanium.UI.iPhone.createGroupedSection

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:50:06.000+0000
Affected Version/sn/a
Fix Version/sRelease 0.5
ComponentsiOS
Labelsn/a
ReporterNolan Wright
AssigneeReggie Seagraves
Created2011-04-15T02:22:26.000+0000
Updated2011-04-17T01:50:06.000+0000

Description

Description

The purpose of this API is to create a section within a grouped view. There are three types of sections: option lists (only one option can be active), button lists, and input list.

Grouped sections are added to Grouped Views

Example

var buttonData = [
    {title:'Button 1', image:'images/one.png'},
    {title:'Button 2', image:'images/two.png'}
];

var buttonSection = Titanium.UI.iPhone.createGroupedSection({type:'button',data:buttonData});
buttonSection.addEventListener('click',function(e)
{
    e.index // index of clicked button
});

var optionData = [
    {title:'Option 1', image:'images/one.png'},
    {title:'Option 2', image:'images/two.png', selected:true},
    {title:'Option 3', image:'images/three.png'}    
];

var optionSection = Titanium.UI.iPhone.createGroupedSection({type:'option', data:optionData});
optionSection.addEventListener('click',function(e)
{
    e.index // index of clicked button
});

var switchInstance = Titanium.UI.createSwitch({value:false});

var inputData = [
    {title:'Input 1', image:'images/one.png', input:switchInstance},
    {title:'Input 2', image:'images/two.png', value:'foo', hasChild:true},
    {title:'Input 3', image:'images/three.png'} 
];

var inputSection = Titanium.UI.iPhone.createGroupedSection({type:'input', data:inputData});
inputSection.addEventListener('click',function(e)
{
    e.index // index of row that was clicked (used if you row will create a new window)
});

API Arguments

data : the data object used to create the table view

type : the type of grouped section. valid values are: input, option, and button

Data Object Detail

title : row title

image : optional. path of an image. Images are placed on the far left side of a row

hasChild : optional. valid values are true|false. indicates that clicking the row will create another window. the default value is false. also, if hasChild is true the default "more icon" should be displayed (e.g., for iphone the ">" would be displayed).

value : optional. the text string to be displayed to the right of the title (in the standard blue font color)

header : optional. header text for grouped section

footer : optional. footer text for grouped section

selected : optional. valid values are true|false. this is only used for "option" grouped sections.

input : optional instance variable of an input control (e.g., checkbox, slider, input field). Note: the callback responsibility falls onto the input control not the table view.

Comments

  1. Blain Hamon 2011-04-15

    Implemented as of June 23

JSON Source