Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14774] Android: Adding button to tableViewRow prevents row touch events

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2013-08-26T21:12:52.000+0000
Affected Version/sRelease 2.1.4, Release 3.1.0, Release 3.1.1
Fix Version/s2013 Sprint 18, 2013 Sprint 18 API
ComponentsAndroid
Labelsandroid, ipass1, mobile, mobilesdk, titanium, triage
ReporterAshish Nigam
AssigneePing Wang
Created2013-08-07T09:51:06.000+0000
Updated2017-03-28T20:26:31.000+0000

Description

Adding button object to tableViewRow prevents tableViewRow Object touch or click events. Steps to reproduce: 1: Use the below mentioned code in a alloy project. **index.js**
function doClick(e) {  
    alert($.tableView);
}

function doClick1(e) {  
    alert("$.tableView");
}
$.index.open();
**index.xml**
<Alloy>
	<Window class="container">
		<TableView id="label" onClick="doClick">Hello, World
			<TableViewRow id='row' class='row' className= 'categoryRow' width='Ti.UI.FILL'>
                <Label id="categoryName" width = '150' text="touch test" left = '150' touchEnabled="false"/>
                <Button id="categoryCount" onClick="doClick1" right = '225' width="40" height="50" backgroundColor="red" touchEnabled="false"/>
                <ImageView id="rightImage" height='Ti.UI.SIZE' width='Ti.UI.SIZE' image='/appicon.png' right='0' touchEnabled="false"/>
        </TableViewRow>
		</TableView>
	</Window>
</Alloy>
**index.tss**
".container": {
	backgroundColor: "white"
},
"Label": {
	width: Ti.UI.SIZE,
	height: Ti.UI.SIZE,
	color: "#000"
},
"#row":{
	backgroundColor: 'white',
	height: 150,
	backgroundSelectedColor: 'red'
}
2: Test the app in any android device, preferred is android version 4.1.2 device. 3: tapping on tableView row does not change the selectedBackgroundColor. **now change the Button to View in index.xml** and repeat the steps, everything works fine.

Comments

  1. Ashish Nigam 2013-08-12

    Also reproducible using Titanium Standard project. **sample code**
       var win = Ti.UI.createWindow({
       	backgroundColor : 'white'
       });
       
       var tbView = Ti.UI.createTableView();
       
       var tbRow = Ti.UI.createTableViewRow({
       	title:"touch test",
       	selectedBackgroundColor:"red"
       });
       
       var buttn = Ti.UI.createButton({
       	title:"test click",
       	height:150,
       	width:150
       });
       
       tbRow.add(buttn);
       
       tbView.data = [tbRow];
       
       win.add(tbView);
       
       win.open();
       
  2. Ping Wang 2013-08-26

    This is a native Android behavior. Add
    buttn.focusable = false;
    to the above test case will make the click event works on both the button and the table view row. Here are some similar posts: http://stackoverflow.com/questions/7763983/how-to-do-button-click-and-list-view-item-click-in-customize-list-view-in-androi http://stackoverflow.com/questions/3045872/listview-and-buttons-inside-listview Resolve the ticket as Invalid.

JSON Source