Topener / nl.fokkezb.pullToRefresh

Widget to implement a table pull-to-refresh header in Titanium Alloy
184 stars 60 forks source link

widget programatically TabGroup #68

Closed efrainhernandez closed 8 years ago

efrainhernandez commented 8 years ago

I have the below code but does not show the widget In tabgroup. function populateCategories(data) {

_.each(data, function(category) {
    var win = Ti.UI.createWindow({
        title : category.name,
        backgroundColor : '#f4f4f4'
    });
    var listView = Ti.UI.createListView({
        top : 0,
        left : 0,
        width : Titanium.UI.FILL,
        height : Titanium.UI.FILL
    });

    var ptr = Alloy.createWidget('nl.fokkezb.pullToRefresh', {
        children : [listView]
    });

    ptr.on('onRelease', refresh);

           win.add(listView);

    var tab = Ti.UI.createTab({
        window : win,
        title : category.name
    });

    _tabs.push(tab);
});

_tabGroup = Ti.UI.createTabGroup({
    tabs : _tabs
});

_tabGroup.addEventListener('focus', function(evt) {
    if ( typeof evt.index !== 'undefined') {
        Alloy.Globals.currentTab = evt.index;
    }
});

_tabGroup.open();

Alloy.Globals.tabGroup = _tabGroup;

}

FokkeZB commented 8 years ago

Is this on iOS or Android? On Android you'd have to add ptr.getView() to the Window.

efrainhernandez commented 8 years ago

Is Android, still not working :

var ptr = Alloy.createWidget('nl.fokkezb.pullToRefresh', { children : [listView] }).getView();

FokkeZB commented 8 years ago

And then you add do window.add(prt) ?

efrainhernandez commented 8 years ago

You're absolutely right , I appreciate your time.