| 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 |
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";
};
Sep 8, 2013
(No comment was entered for this change.)
Status:
Duplicate
Mergedinto: 369 |
Labels: Milestone-Release1.2.5