my ontap is not firing on my paragraph.

edited January 2013 in Newbie Questions
Hey Folks,

Anyone here has a clue why this ontap even it never firing?
this.$.content.createComponent({
	tag: "p",
	ontap: "showMore",
	content: this.definition.substring(0, 320) + "... click to show more."
});
the showMore is defined as:
showMore: function() {
  console.log("clicked!");
}
It is defined on my 'Entry' kind which has the 'content' component in its components array, the paragraph is a child control of content.

If I define the function showMore on my Entry kind, the ontap event of the paragraph will bubble from the paragraph to the container div to the entry div?

I need to understand events better, I can't make my events bubble or waterfall...

cheers and thanks

Comments

  • Is showMore defined in this.$.content? Using the ontap property means naming a method that's defined in the owner of the component.

    You might want to create the component in your "this", and use a container property to specify that it goes into this.$.content, e.g.
    this.createComponent({
    	container: this.$.content,
    	tag: "p",
    	ontap: "showMore",
    	content: this.definition.substring(0, 320) + "... click to show more."
    });
  • Thanks for the reply Ben! showMore is defined on the Entry kind that holds this.$.content in its components. I will follow your advice.
Sign In or Register to comment.