Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

findAncestorWithClass

 
shanthisri mocherla
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ranchers

I'm having some trouble with the findAncestorWithClass(tag,class) method.

I've a question??
It returns an instance of the class we are passing as the argument to the method right??


So if I have two tags one nested inside the other i.e one parent tag and one child tag.

Then can i get the name of the parent tag by using this method??

<mine:Menu>
<mine:MenuItem/>
</mine:MenuItem>


Thanks for helping me
Shanthi
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I've a question??
It returns an instance of the class we are passing as the argument to the method right??


Correct


So if I have two tags one nested inside the other i.e one parent tag and one child tag.
Then can i get the name of the parent tag by using this method??


Yes you can.

NOTE:
findAncestorWithClass(tag,class) is generally used to get the top-level instance skiping some levels. So if you looking for a immediate parent you can use getParent() method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic