I have created a tableview (50 items) and detail view for each row on an app in development (non database), the app now needs 350 items and subsequent detail views. If so, is there a simple example to open an sqlite database, populate a tableview and link to a detail view all created from the database? I have read and sampled the pdfs on the site and seen the 'persistence' sample but a tableview to detail view sample would really cut out some development time. Can anyone point me in the right direction.
Ok, edited down code is here: http://pastie.org/1254708
I need help too!
I think I understand the question, and I think I have code to help you. My first app is a joke database with table views. http://bit.ly/cleanjokes First table view is category. Click on category, which opens a new table view to list of joke titles. Click on a title, which opens a web view to show the joke.
All of this data (categories table, jokes table) is stored in a SQLlite database. So there is only one page of tableview code, and the rows change based on user clicks, pulling data from the database on demand.
Is that close to what you're looking for? If so I'll post some (cleaned up and edited) code tonight for you.
PS - contact me if you want a promo code for the app (US iTunes store only). http://www.prairiewest.net/contact.php
So, if I am not mistaking, you made a tableview with 50 records, and then 50 views with details for those records on the tableview. If that is the case, no offence, but that is just bad thinking. If there are more than 3 views with the same layout, you have to make it generic. And even 3 is a big number.
I am new to Titanium, so this may not be the most advised answer, but with my 3 years web development background I would take this approach:
Read your data for the tableview from the database, construct the tableview, create a detail view, but do now open it.
Upon click on the tableview, pass the id of the current row to the detail view, fetch the description for that row from the database, add it to the view and then show it. Going back should be just a matter of closing it, and next time doing it the same way. It would not take more than 30 new lines of code to your existing app.
This is how i would do this. Hope it helps.
How can i reload the tableview on focus?