Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1223] iOS: Events on Custom Template of ListView does not work well, when add Scrollable View into Template

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2015-03-27T02:54:09.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.7.0
Componentsn/a
LabelsListView, ScrollView, Templates, event
ReporterShuo Liang
AssigneeIngo Muschenetz
Created2015-01-09T05:26:08.000+0000
Updated2015-03-27T02:54:09.000+0000

Description

IOS: Events on Custom Template of ListView does not work well, when add Scrollable View into Template

Reproduce:

1.Run the following test case on Alloy Project.

Problem:

When add onSingletap event to Label inside template, it works well. But If add same event to scrollable View inside template, build will failed with "undefined" error.

Test Case:

var view1 = Ti.UI.createView({ backgroundColor:'#123', width:"200"});
var view2 = Ti.UI.createView({ backgroundColor:'#246', width:"200"});
var view3 = Ti.UI.createView({ backgroundColor:'#48b', width:"200"});

var dataSet = [{ 
	scroll: {
		views:[view1, view2, view3],
	},
	properties:{
		height: 200,
        selectionStyle: 0
	},
}];
$.section.appendItems(dataSet);

function testClick(e) {
	Ti.API.info("test single tap");
};

$.index.open();
<Alloy>
	<Window class="container">
		<ListView id="listView" defaultItemTemplate="template">
		<Templates>
                        <ItemTemplate name="template">
                	      <Label buildId="label" left="0" text="test" width="Ti.UI.SIZE" color="black" onSingletap="testClick"/>
                              <ScrollableView bindId="scroll" backgroundColor="white" clipViews="false" left="100" showPagingControl="ture" width="200" />                
                         </ItemTemplate>
                </Templates>
                <ListSection id="section" headerTitle="Test"/>
		</ListView>
	</Window>
</Alloy>
Here is the [Wiki Ref](https://wiki.appcelerator.org/display/guides2/Alloy+ListView+Guide#AlloyListViewGuide-HandlingEventsonTemplateViews)

Comments

  1. Ingo Muschenetz 2015-01-09

    I'm not positive why you would want to add a scrollable view. Can you give more information?
  2. Ingo Muschenetz 2015-01-09

    [~skypanther] Might this be an ALOY issue?
  3. Shuo Liang 2015-02-03

    Any update one this?
  4. Tim Poulsen 2015-02-03

    As stated earlier, the customer is attempting to use an antipattern here and should consider the alternatives proposed earlier. The ListView is not intended for this sort of use. Events will not propagate and be accessible in a useful manner, even if we made the Alloy compiler were made to work.
  5. Shuo Liang 2015-03-27

    [~ingo], Sorry for the late update. I will close this ticket as invalid, since customer might change design.

JSON Source