This tutorial shows how to create a tableview in Titanium and add data to it.
How to handle a click function in the tableView and get the data from the row.

   /* Create a new window */
   var win = Titanium.UI.createWindow({

	/* Datasource for the tableView */
    var my_data = [

    var tableview = Titanium.UI.createTableView({

	/* Alternately you can use this to set the datasource in the tableView.

	/* this will handle the click function in the tableView */
	tableview.addEventListener('click', function(e)
		e.rowData.hasCheck = true;		 // add a checkmark to the row.
		var title = e.rowData.title;	       // get the title property of the clicked row.
                var index = e.index;                     // got the clicked index;
      "Clicked on index : " + index + "with row title : " + title);

	win.add(tableview); 				// add the tableview to the window.;							// open the window.

Please leave your valuable comments.


Leave a Reply

Your email address will not be published. Required fields are marked *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.