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

When remove element it still has a parent on Android

$
0
0

Hi, there! I have several tabs. Each tab has bottom border which must be invisible when tab is active. I use view for bottom border 100% width and 1dip height. When tab is clicked all views which acts as bottom borders, are added to their parents, and bottom border on clicked tab is removed.

Here comes the problem: When I remove bottom border view i keep reference to it and when i have to put back all bottom borders i check the reference and if it has NO parent i added to tab which it belongs.

Next are parts of my code:

function setTabInits(){
    for(i in createBarItem.items){
        var item = createBarItem.items[i];       
        if(!item.bottomBorder.getParent()){
            item.add(item.bottomBorder);
        }
    }
}
and:
function clickTab(ops){
    setTabInits();
    this.remove(this.bottomBorder);
         .........
}
createBarItem.items is reference to all tab views item.bottomBorder is reference to view which plays bottom border for tab

The problem is that when i remove bottom border view with this.remove(this.bottomBorder); this.bottomBorder still has a parent? This happens only on android - on iOS it works without a problem.

In this case i can use visible property instead but there is cases where i need to remove view because it influence on the design and i want to put it back later without recreating it, but how to check is it added or not when it always has a parent view?

Maybe i can set additional property which value to switch between true and false if it is added but this is not the point, the parent property of view must be correct! as it is on iOS


Viewing all articles
Browse latest Browse all 8068

Trending Articles



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