Hi Guys, I am Facing an issue from many days . I dont even kn how to put my issues in words. I am using Slider Menu. My Code is
app.js
var my = { views:{}, menu : require('./SlideOutMenu/MASlidingMenu'), sampleView : require('sample_views') }; my.views = { home : my.sampleView.placeholderView({title:'Home',backgroundColor:'blue'}), inbox : my.sampleView.placeholderView({title:'Home',backgroundColor:'green'}), sales : my.sampleView.placeholderView({title:'Home',backgroundColor:'yellow'}), customers : my.sampleView.placeholderView({title:'Home',backgroundColor:'blue'}), about : my.sampleView.placeholderView({title:'About',backgroundColor:'purple'}) }; // Each row with a view property when clicked will change to that view (any view works except tabgroups and windows) // If the row does not have a view property, but the switch event still fires var menuData = [ { title:'Home', hasDetail:true, view: my.views.home }, { title:'Inbox', hasDetail:true, view: my.views.inbox }, { title:'Sales', hasDetail:true, view: my.views.sales }, { title:'Customers', hasDetail:true, view: my.views.customers }, { title:'About', hasDetail:true, view: my.views.about }, { title:'Logout' } ]; my.menu.addMenuItems(menuData).open(); // event fired when user selects a view from the nav my.menu.addEventListener('buttonclick', function(e) { if (e.index === 2) { alert('You clicked on Logout'); } }); // event fired when user selects a view from the nav my.menu.addEventListener('switch', function(e) { Ti.API.info('menuRow = ' + JSON.stringify(e.menuRow)); Ti.API.info('index = ' + e.index); Ti.API.info('view = ' + JSON.stringify(e.view)); my.views[0] = { home : my.sampleView.placeholderView({title:'Home',backgroundColor:'blue'})}; //my.menu.addMenuItems(menuData); });and my sample view.js is
exports.placeholderView = function(args){ alert('Inside Exports'); var view = new menu.createMenuView({ backgroundColor:args.backgroundColor }); var db=require('lib/network'); var myView=Ti.UI.createView({ layout:'vertical', top:20 }); var myTable=Ti.UI.createTableView({ top:30 }); var categoryid=30; function populateData() { db.list(categoryid, function(list) { //alert('Inside Populate'); var result = list; myTable.setData(result); }); } myView.add(myTable); Ti.App.addEventListener('databaseUpdated', populateData); //run initial query populateData(); view.remove(myView); myTable.addEventListener('click',function(e){ var ID=e.rowData.id; view.remove(myView); var page2=require('Slide2'); myView=new page2(ID); view.add(myView); return view; }); view.add(((_isAndroid)? createAndroidToolbar(args.title) : createiOSToolbar(args.title))); view.addEventListener('dblclick',function(e){ Ti.App.fireEvent('app:close_menu'); }); view.add(myView); alert('Before final return'); return view; };The Problem i am facing is When i select row (sampe_view.js) Its displaying properly. But then if i select view from menu its displaying current view instead of tableview eventhough i have remved the view. I hope i am not confusing as i mentioned i really dono how to put them in words but this bug is bugging me from days