Question

My application has two views.

One view is fixed 50pt height.

the other view must be 100% - 50pt.

How can I do this calculate in tss?

or is it impossible?

If so how can I decide the windowsize?

index.tss

"#tableView": {
    width: "100%" -50,
    height: "98%",
    top:0
}


"#adView": {
    backgroundColor:"black",
    width: "100%",
    height: 50,
    bottom: 0 
}
Was it helpful?

Solution

Use the Titanium.Platform.DisplayCaps.platformWidth property to get the size of the window, assuming that the #tableview's parent is the app window:

#tableview : {
    width : Titanium.Platform.DisplayCaps.platformWidth - 50,
   height: "98%",
   top:0
}

Option 2 is you can calculate this inside your controller using the postlayout event like this:

function adjustTableWidth(e) {
    $.tableView.width = $.tableView.rect.width - 50;
    // Remove the listener so it doesn't keep calling infinitely
    $.tableview.removeEventListener('postlayout, adjustTableWidth);
}
$.tableview.addEventListener('postlayout, adjustTableWidth);

Just make sure if you use option two, you set the TSS to this:

"#tableView": {
    width: "100%",
    height: "98%",
    top:0
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top