My favorites | Sign in
Project Home Downloads
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 421: Adding a class to the title breaks using onClick function that checks if title was clicked
1 person starred this issue and may be notified of changes. Back to list
Status:  Duplicate
Merged:  issue 369
Owner:  ----
Closed:  Sep 2013


 
Reported by john.a.s...@gmail.com, Apr 22, 2013
I'm using dynatree 1.2.4, and add a class to some titles onRender so I can differentiate them visually, ie 

    if(node.data.my_folder !== true) {
          $(nodeSpan).find('.dynatree-title').addClass('not-mine');
    };

This, however, breaks my onClick function and prevents it from firing: 

           onClick: function(node, event) {
                if(node.getEventTargetType(event) === "title"){
                   //change another pane in the page, do some other stuff
                };

It turns out that under the covers, node.getEventTargetType is checking to see if the class name is === this.tree.options.classNames, which only contains the original "dynatree-title" class.  Thus node.getEventTargetType returns false, when in fact i am clicking on the title.  My patch looks at whether string dynatree-title is contained in the set of classes.  I wanted to check if there was a better/faster way to do this though, or alternative supported method.

Here is the original code from the function getEventTargetType, followed by my patch:

original:
		 if( tcn === cns.title ){
		 	return "title";
		 };


patch:
		if( tcn.indexOf(cns.title ) !== -1 ) {
			return "title";
		};
Apr 22, 2013
Project Member #1 moo...@wwwendt.de
thanks!
Status: Accepted
Labels: Milestone-Release1.2.5
Sep 8, 2013
Project Member #2 moo...@wwwendt.de
(No comment was entered for this change.)
Status: Duplicate
Mergedinto: 369

Powered by Google Project Hosting