Disable TableViewRows when overlay present
Hey there. I have a table of selectable items. On occasion, there is an independent window that is OVER this table. It might be an activity indicator or a custom dialog window. When this overlay window is present. I'd like to disable the buttons on the table behind it. I tried to use the following function but it didnt disable the rows. Is there another method I should be trying.
Thanks
Fish
function tableRowsClickable(theTable,v) {
var sections = theTable.data;
for (var i = 0; i < sections.length; i++) {
var section = sections[i];
for(var j = 0; j < section.rowCount; j++)
{
section.rows[j].touchEnabled = v;
section.rows[j].hasChildren = v;
if(v) {
section.rows[j].selectionStyle=Titanium.UI.iPhone.TableViewCellSelectionStyle.BLUE;
} else {
section.rows[j].selectionStyle='none';
}
}
}
}
1 Answer
-
Accepted Answer
I typically create a transparent window the full device screen size to cover the table and then add my activity indicator onto a black view which I add to the transparent window. Since there is a full screen window covering the table it prevents the user from clicking on the table. I also set the currentWindow.touchEnabled = false.
var winHeight = 90; var winWidth = 200; if (Titanium.UI.currentWindow != undefined) { Titanium.UI.currentWindow.touchEnabled = false; Titanium.UI.currentWindow.tabGroup.touchEnabled = false; winHeight = Titanium.UI.currentWindow.height; winWidth = Titanium.UI.currentWindow.width; } if (Titanium.Platform.name == 'iPhone OS') { var winActivity = Titanium.UI.createWindow({ height: winHeight, width: winWidth, touchEnabled: false }); vwBlackBack = Titanium.UI.createView({ height: 90, width: 200, backgroundColor: '#000', borderRadius: 10, opacity: 0.8, touchEnabled: false }); //Add some text & an activity indicator to vwBlack winActivity.add(vwBlackBack); winActivity.open(); }