Search code examples
iphonetitaniumappceleratorappcelerator-mobile

Appcelerator ScrollView and TableView in a Window


i have a Window and i want to have a ScrollableView in the top and a TableView in the bottom area. How to do that?

I have the following code:

var currentWin = Ti.UI.currentWindow;

var dbdata = [
    { title: '' + man.fieldByName('manufacturer') + '', header: 'Manufacturer' },
    { title: '' + rows.fieldByName('series') + '', header: 'Series' },
    { title: '' + rows.fieldByName('engine') + '', header: 'Engine' },
    { title: '' + rows.fieldByName('horsepower') + '' , header: 'Horsepower' },
    { title: '' + rows.fieldByName('yearfrom') + ' to ' + rows.fieldByName('yearto') + '' , header: 'Year' },
    { title: '' + rows.fieldByName('types') + '' , header: 'Engine Type' }
];

var tableView = Ti.UI.createTableView({
    data: dbdata,
    top: 156
});


var image1      = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image1.jpg'});
var image2      = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image2.jpg'});
var image3      = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image3.jpg'});
var image4      = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image4.jpg'});
var image5      = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image5.jpg'});
var image6      = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image6.jpg'});

var scrollView = Ti.UI.createScrollableView({
    views:[image1,image2,image3,image4,image5,image6],
    showPagingControl:true,
    clipViews:false,
    top:0,
    left:30,
    right:30,
    width:320,
    height:156,
    opacity:0
});

currentWin.add(tableView);
currentWin.add(scrollView);

But when i use the upper code, only my tableView is shown. When i only use currentWin.add(scrollView) and remove the currentWIn.add(tableView), the scrollView is shown - but never both - why?!?!?

Notice: i have removed the database queries from the code sample!!!

Hope you can help?

Thanks, Sascha


Solution

  • remove the following parameter opacity: 0 in Ti.UI.createScrollableView function call.

    Regards. Adun