Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Add view to DrawerLayout outside index.js

$
0
0

Hello, I am using for my project Ti.DrawerLayout by ricardoalcocer. I've got the view category.js created and added to the drawer in index.js:

var controls = require('controls');
var categoryView = controls.getCategoryView();
$.drawer.drawermainview.add(categoryView.getView());
controls.js
exports.getCategoryView = function () {
    return Alloy.createController('category');
};
exports.getSecondView= function () {
    return Alloy.createController('second');
};
I'm trying to create another view in category.js and replace it in the drawer when button in category.js is clicked, but i cant access $.drawer.drawermainview from category.js. Can anyone help me?

category.js

var controls = require('controls');
 
$.btn.addEventListener('click', function(e){                  
 
     replaceSecondView();       
 
}); 
 
function replaceSecondView() {
    var secondView=controls.getSecondView();
    $.drawer.drawermainview.add(secondView.getView());
}

System: OSX 10.10, Titanium 3.5.2. GA

Thanks in advance,

Brudzio


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>