Useful Titanium Mobile TableView Tips

I’ve been using Titanium Mobile for awhile now.I highly recommend giving it a try if you haven’t already.  You can learn more at the Appcelerator developer center

Since most mobile UI’s use some form of a TableView I thought I’d share a few tips for working with Titanium’s implementation of this control.

Getting Row Count

If you allow your user to delete rows in your TableView control it is often helpful to know how many rows are left.  To avoid querying the database on each delete, you can simply get the length of the TableView section, such as tableView.data[0].rows.length in the below sample.

blog1

Updating A Row With Child Controls

Titanium offers a rich TableView API that allows you to use almost any control within a row.  This provides the flexibility to create some pretty amazing UIs but, can provide a change when you need to update one of the controls within the row.  Below is an example how of you can use application events to update a row with controls from another window.

blog3

You can download the sample project here

To learn more about the TableView control from Appcelerator’s documentation available here.

0 comments:

Post a Comment