Titanium JIRA Archive
Appcelerator Community (AC)

[AC-437] TableViewSection click event is not working in titanium mobile application

GitHub Issuen/a
TypeImprovement
Priorityn/a
StatusResolved
ResolutionNeeds more info
Resolution Date2015-11-13T18:23:43.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAlloy, Appcelerator Modules, Studio
Labelsalloy, onclick, tableview, tableviewrow, tableviewsection, titanium
Reporterkrishnaveni
AssigneeShak Hossain
Created2015-04-23T06:03:38.000+0000
Updated2015-11-13T18:23:43.000+0000

Description

I have developed one application based a below tree structure: Default : Category Category Category While clicking the category : Category Sub Category Product Category Category Some times: Category Category Product Category Here i have to implement this concept using the tableview. Yes i have created the tableview and then i have created the tableviewsection .i have added the categories in the tableviewsection.i have created the tableviewrow within the tableviewsection. If i have clicking the selected category, i have added the subcategory values in these tableviewrow. But some category having the subcategory ... some of the category doesnot have the subcategory.straightly having the products.So can you please explain me Here the categories are listed.But if am clicking the category it will listed out the subcategory.But i can't view the subcategory. Can you check with this and give me a solution Please see my attachment code:

Attachments

FileDateSize
sample.js2015-04-23T13:46:05.000+00004009
sample.js2015-04-23T06:03:38.000+00006035

Comments

  1. Amimul Hossain 2015-10-07

    Hello Can you take a look at the below code? Event listener in tableview custom section is working when you click on the custom view. Thanks.
       Ti.UI.backgroundColor = 'white';
       var win = Ti.UI.createWindow();
       
       var tableView = Ti.UI.createTableView({
       	height : '100%',
       	width : '100%',
       	separatorColor : '#111214',
       	allowsSelection : true,
       });
       
       win.add(tableView);
       
       var dataArray = [];
       
       for (var i = 0; i < 20; i++) {
       	var customsection = Ti.UI.createView({
       		width : Ti.UI.FILL,
       		height : Ti.UI.SIZE,
       		id : i,
       		top : 0,
       		bottom : 0,
       	});
       
       	var text = Ti.UI.createLabel({
       		text : 'Fred Smith ' + i,
       		left : 20,
       		color : '#000'
       	});
       	customsection.add(text);
       
       	row = Ti.UI.createTableViewSection({
       		headerView : customsection,
       	});
       
       	dataArray.push(row);
       	
       	customsection.addEventListener('click', function(e) {
       		Titanium.API.info("You clicked the button " + e.source.id);
       	});
       };
       tableView.setData(dataArray);
       
       win.open();
       

JSON Source