Return to and update underlying window/tableview
Hi (again) :)
Got a new question for the experts :)
I've got a tabbed app with 2 tabs. The first one is the interesting one. Here you're presented with a tableview, you can click through to yet another tableview and from here to a "details" view.
So something like this:
Root of tab (tableview, list of items)
-> List of subitems (tableview)
–> Details view
I would like to know two things:
How do I go directly from the details view to the root table view (skipping the middle subitems view/window)?
How do I refresh the data in the root tableview triggered by an action in the detail view? Let's say a click of the button on the detail view adds an item/row to the root table view.
I hope you can help me out - I didn't find anything related to this in the KitchenSink app :(
4 Answers
-
Normally when an app goes back to the root panel it wants to close everything (windows/views) it has open. One way to do it is to keep track of the window/view hierarchy you have open (by using custom properties whenever you open a new window/view). Then when you are in your details view you can close all intermediate windows and/or remove opened views by calling their corresponding close() or remove() APIs. Alternatively you can try to hide those windows/views if you need to go back and don't want to recreate those objects.
One way to do it is to pass the parent tableview info when you open you detail view then when you want to update the parent tableview you can its APIs (such as appendRow())
-
Hi Kyle,
Thanks for your answer.
I'm working on #2 and I've been able to use both setData and insertRowBefore with the same result. The new rows is added and displays fine. But their properties is undefined (tried Ti.API.info(e.rowData.title)) and when you scroll in the tableview, the entries becomes blank.
Do you have any idea about what could be causing this?
Thanks in advance.
-
hi, look like im facing same #2 problem. i need to change my root's properties and i didn't understand your explanation. could you attach some sample code please?
Thanks in advance
Wilson
-
Hey guys…I've had this type of issue a lot as well. I've solved it by using app wide event listeners. You set the listener in the underlying view, then fire it in the detail view.