Titanium JIRA Archive
Alloy (ALOY)

[ALOY-466] Alloy TableViews with sections not reliably passing 'click' events

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-01-29T18:10:23.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 03
ComponentsRuntime, XML
Labelsalloy, events, tableview, tableviewsection
ReporterJoel Margolese
AssigneeTony Lukasavage
Created2013-01-16T06:59:47.000+0000
Updated2014-01-29T00:07:11.000+0000

Description

If you create a TableView in an Alloy View, and then populate it with TableViewRow's which are created from Alloy view files, then click events are not passed to the parent. NOTE: if you create rows in dynamically in code or pre-defined in the TableView.xml file, then click events are passed. ref: [Q&A | http://developer.appcelerator.com/question/146467/alloy-tableviews-with-sections-not-passing-click-events] code to reproduce: *index.xml*
<Alloy>
    <Window>
    <TableView id="jobsTable" onClick="rowWasClicked">
        <TableViewSection id="activeSection" headerTitle="Current jobs"/>
        <TableViewSection id="futureSection" headerTitle="Future jobs">
           
        </TableViewSection>
    </TableView>
    </Window>   
</Alloy>
*testRow.xml* (.js and .ts files are blank)
<Alloy>
    <TableViewRow id="row">
        <View id="view" backgroundColor="red" width="20" height="20"  />
    </TableViewRow>
</Alloy>
*index.js*

function rowWasClicked(e) {
    alert('you pressed me');
}
 
for (var i = 0; i < 5; i++) {
   //$.activeSection.add(Ti.UI.createTableViewRow({title: 'row ' + (i+1)}));
 
   var args = {};
   var row = Alloy.createController('testRow', args).getView();
    //row.bubbleParent = true;
 
     $.activeSection.add(row);
 
}
 
$.index.open();
_notes_ (tableViewRow.xml is code I took from the TableViewRow online doc.) If I remove the View (in the row), it works perfectly. If the View is in place, then only the 1st row responds to taps. (Using the iOS simulator.) The other rows are silent. It seems that other elements (

Comments

  1. farid fadaie 2013-01-17

    Tony, Not sure if this is a duplicate of 1767 but I cross my fingers. Thanks for looking into it. Since this is rather blocking us, would you have any ETA?
  2. Tony Lukasavage 2013-01-18

    The fixVersion gives an indication of ETA. This is slated for Alloy 1.0.1. Alloy 1.0.0 is tentatively scheduled for mid-February. The good thing about Alloy is that it is almost never technically "blocking". If you are unable to get the functionality you need in Alloy you can always fall back to constructing the table with sections in traditional Titanium code in your controller until this bug is fixed.
  3. Tony Lukasavage 2013-01-29

    Can't reproduce. I ran the given test code against Titanium SDK 3.0.0.GA, both Alloy 1.0.0 and 0.3.6, and iOS sim 6.0 and both respond to clicks on all the rows in the section. Will reopen if a new failing test case is provided.
  4. farid fadaie 2013-01-29

  5. heenok 2013-02-05

    Hi, I have exactly the same problem as Joel. I'm on Titanium SDK 3.0.0.GA, Alloy 1.0.1 Anyone as a solution ? Thanks
  6. Tony Lukasavage 2013-02-05

    Test case please as I have yet to reproduce this on my end. Once a test case has been posted I can revisit.
  7. heenok 2013-02-05

    Here my case : index.js
     
       function rowWasClicked(e) {
           alert('you pressed me');
       }
       $.index.open();
       
    index.xml
     
       <Alloy>
       	<Window>
       		<TableView id="table" top="0dp" height="100%" separatorStyle="none" onClick="rowWasClicked">
       			<!-- First row : never moves -->
       			<TableViewRow id="row">
       				<Require type="view" src="detail" />
       			</TableViewRow>
       		</TableView>
       	</Window>
       </Alloy>
       
    detail.xml
     
       <Alloy>
         <View id="copyright">
       	<Label class="content_text" top="15dp" text="blabla" />
         </View>
       </Alloy>
       
    detail.js
     
       $.copyright.addEventListener('click', function(e) {
           alert('Hello');
       });
       
    Both Events are never fired. ///Update It seems that UI inside don't react at all. A more basic case fails : index.xml
       <Alloy>
       	<Window>
       		<TableView id="table" top="40" height="100%" separatorStyle="none" >
       			<!-- First row : never moves -->
       			<TableViewRow height="100">
       				<Label id="price">Available</Label>
       			</TableViewRow>
       		</TableView>
       	</Window>
       </Alloy>
       
       
    index.js
       $.price.addEventListener('click',function(e) {
       	alert('Click Event');
       });
       $.index.open();
       
  8. Tony Lukasavage 2013-02-10

    Again, cannot reproduce. The label is generating the click event just fine for me. Are you sure there's not more code you aren't showing or something, because I just verified that everything works fine against your simpler test case.
  9. heenok 2013-02-10

    Thanks for your time Tony. There's no more code. If it works for you then i will re-install Titanium, and launching a new Alloy project.

JSON Source