I hope you will be fine. I am having trouble updating views in Titanium Appcelerator Alloy,
I basically want to be able delete previous children from picker and then add new one in picker that is in a different controller/view that i am currently in.....
I have followed this THIS SOLUTION unfortunately that is not working for me. Here is the code I am trying.
createEvent.js
Ti.App.addEventListener('db_update', function(){
alert("OK");
$.picker.removeAllChildren();
})
customParty.js
$.btnclick.addEventListener('click', function(){
Ti.App.fireEvent('db_update');
});
// OK alert shows up but the children of picker aren't removed.
Since Ok Alert is shown, you are in the good way and the callback function is called successfully. The problem here is that calling
removeAllChildren
method is not removing rows from your picker. the solution is to iterate over colums and delete rows like this :By the way Applcelerator's folks said that using global events (Ti.App events) may cause problems in memory managements...
Another method is to use global functions:
In your first view controller (where picker is defined):
then in the seconde viewcontroller: