Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12616] iOS: TableView Click Events dont get added under certain circumstances

GitHub Issuen/a
TypeBug
PriorityHigh
StatusResolved
ResolutionCannot Reproduce
Resolution Date2013-11-21T19:33:05.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sRelease 3.1.0, 2013 Sprint 06 API, 2013 Sprint 06
ComponentsiOS
Labelsapi, module_tableview, parity, qe-testadded, release-note, triage
ReporterRick Blalock
AssigneeIngo Muschenetz
Created2013-02-07T15:28:01.000+0000
Updated2017-12-18T14:58:31.000+0000

Description

If a section is added to a table using table.appendSection, table.sections = [mySection]; any events on a tableview dont work. Below are some samples. What works is contrary to the 3.0 documentation where it says now in 3.x+ the section methods and properties should be used over data:

var win = Ti.UI.createWindow({
	backgroundColor:"#eee"
});
win.open();

var table = Ti.UI.createTableView();
var section = Ti.UI.createTableViewSection();
section.headerView = (function() {
	var view = Ti.UI.createView();
	var label = Ti.UI.createLabel({ text: "Some Section" });
	view.add(label);

	return view;
})();

var row = Ti.UI.createTableViewRow({
	title: "Row"
});

section.add(row);

// THIS WILL KILL THE EVENT LISTENER
//table.sections = [section];

// THIS WILL KILL THE EVENT LISTENER
//table.appendSection(section);

// THIS WORKS
//table.setData([section]);

table.addEventListener("click", function(event) {
	alert("TableView Clicked");
	Ti.API.debug(event.row);
});

win.add(table);

Comments

  1. Arthur Evans 2013-02-07

    Appears to affect other section manipulation methods, such as insertSectionAfter.
  2. Blain Hamon 2013-03-15

    @Rick Is the issue just about the row, or also the section header? Those are two different issues that have similar symptoms, and just wanted to know if you wanted both fixed, or just rows.
  3. Blain Hamon 2013-03-15

    Those playing along, https://github.com/BlainHamon/titanium_mobile/compare/master...timob-12616
  4. Rick Blalock 2013-03-15

    @Blain - The issue the ticket is reporting is if you use the section methods mentioned above, click events dont work. The other part is probably a documentation issue that could spin off as another ticket I assume.
  5. Blain Hamon 2013-03-15

    @Rick Yeah, in retrospect, the tableview click events correspond to the user tapping a row; no such events are generated natively for tapping the header. Creating pull request now.
  6. Blain Hamon 2013-03-15

    https://github.com/appcelerator/titanium_mobile/pull/3971
  7. Vishal Duggal 2013-03-19

    PR Merged
  8. Anshu Mittal 2013-03-21

    Tested with: SDK:3.1.0.v20130319222852 Studio: 3.1.0.201303091040 Device: iPad2(v 5.1) Works as expected.
  9. Arthur Evans 2013-03-21

    Opening to correct labels.
  10. Pragya Rastogi 2013-07-23

    Reopening just to update the labels.
  11. Pragya Rastogi 2013-07-23

    Updated label. Closing as fixed, Verified with environment: OSX: 10.8.4 Xcode:4.5 Appcelerator Studio, build: 3.1.2.201307191853 SDK:3.1.2.v20130718094558 Device: Google nexus 4.0.4, Iphone OS:5.1 acs:1.0.3 alloy:1.1.3 titanium: 3.1.1 titanium-code-processor:1.0.1
  12. Seth Benjamin 2013-11-06

    I am seeing this same issue in 3.1.3.GA; Is there possibly a regression? If so I will create a new ticket but it'd make more sense to keep it here.
  13. Mauro Parra-Miranda 2013-11-21

  14. Sabil Rahim 2013-11-21

    Cannot reproduce issue on 3.2.x master (Build: [7e04bf3ec2094770295ec0bf5c833741b0178f04](https://github.com/appcelerator/titanium_mobile/tree/7029e7a83674a8ca4ae66799cc5c377092ab774a)) and 3.1.X (build : ff583e9747925932ca589e277f49799d7c0348bc|https://github.com/appcelerator/titanium_mobile/commit/ff583e9747925932ca589e277f49799d7c0348bc]) Tested on Xcode 5.0.1 on sim 6.1 and 7.0.3
  15. Ceri Morgan 2015-03-23

    Problem still persists, tested on SDK: 3.5.0, Ipad MIni 1 Model A1455.
  16. Rene Pot 2017-12-18

    So... I appear to be having this issue now on 6.3.0 and 6.0.4. Click events don't fire with
            $.dataTableView.setSections(sections);
        
    Click events do fire when I only provide an array of rows for the last section
            $.dataTableView.setData(rows);
        

JSON Source