Skip to content

Commit 067597c

Browse files
committed
Added node.info()
1 parent 2eb9dfc commit 067597c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

demo/sample-events.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@
154154
}).bind("fancytreeactivate", function(event, data){
155155
// alternative way to bind to 'activate' event
156156
// logEvent(event, data);
157+
}).on("mouseenter, mouseleave", ".fancytree-title", function(event){
158+
// Add a hover handler to all node titles (using event delegation)
159+
var node = $.ui.fancytree.getNode(event);
160+
node.info(event.type);
157161
});
158162

159163
$("#btnSelect").click(function(event){

src/jquery.fancytree.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,16 @@ FancytreeNode.prototype = /** @lends FancytreeNode# */{
852852
hasFocus: function() {
853853
return (this.tree.hasFocus() && this.tree.focusNode === this);
854854
},
855+
/** Write to browser console if debugLevel >= 1 (prepending node info)
856+
*
857+
* @param {*} msg string or object or array of such
858+
*/
859+
info: function(msg){
860+
if( this.tree.options.debugLevel >= 1 ) {
861+
Array.prototype.unshift.call(arguments, this.toString());
862+
consoleApply("info", arguments);
863+
}
864+
},
855865
/** Return true if node is active (see also FancytreeNode#isSelected).
856866
* @returns {boolean}
857867
*/

0 commit comments

Comments
 (0)