Sochettra / dynatree

Automatically exported from code.google.com/p/dynatree
0 stars 0 forks source link

onRender callback #169

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What new or enhanced feature are you proposing?
A callback that would be notified when a node is rendered

What goal would this enhancement help you achieve?
It will allow for processing that depends on the node being rendered...for 
instance context menu bindings.

Original issue reported on code.google.com by ekemo...@gmail.com on 13 Jan 2011 at 3:07

GoogleCodeExporter commented 8 years ago
Do you plan to bind() mouse events, as soon as a node element was rendered?
In this case onRender should fire *after* the node was rendered, i guess.
(I would prefer to use event delegation in this use case, rebinding would not 
be neccessary).

Original comment by moo...@wwwendt.de on 14 Jan 2011 at 7:37

GoogleCodeExporter commented 8 years ago
I intend to bind after the node is rendered...I think you're right, I can use 
JQuery's live function to monitor when nodes are rendered...but I guess a 
convenience callback within dynatree wouldn't hurt either:)

Original comment by ekemo...@gmail.com on 14 Jan 2011 at 3:02

GoogleCodeExporter commented 8 years ago
true

Original comment by moo...@wwwendt.de on 14 Jan 2011 at 4:08

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
The patch for this is in DynaTreeNode.render, to replace this line:

this.span.innerHTML = this._getInnerHtml();

with :

this.span.innerHTML = this._getInnerHtml();
if(opts.onRender){
opts.onRender.call(this.tree,this,this.span);
}

OnRender provides the node and the dom element that represents the rendered 
node, in this case I am supplying the span element, but I am actually 
interested in the link element for the title (I am binding context menu to link 
element so I can also use DnD).

Original comment by ekemo...@gmail.com on 15 Jan 2011 at 4:37

GoogleCodeExporter commented 8 years ago

Original comment by moo...@wwwendt.de on 16 Jan 2011 at 8:09

GoogleCodeExporter commented 8 years ago
Thought: 
an additional 'onQueryRender' could be called *before* rendering.
It can be used to implement the rendering of the node's span/a tag (returning 
'false' to stop default rendering).

Original comment by moo...@wwwendt.de on 16 Jan 2011 at 5:05

GoogleCodeExporter commented 8 years ago
I would say yes, I didn't need that but it is a good bet that someone else 
might need it, you never know what sort of use cases are out there:) Since that 
callback is available for the other events, I'll recommend adding it for 
completeness.

Original comment by ekemo...@gmail.com on 17 Jan 2011 at 1:05

GoogleCodeExporter commented 8 years ago

Original comment by moo...@wwwendt.de on 23 Jan 2011 at 8:44

GoogleCodeExporter commented 8 years ago

Original comment by moo...@wwwendt.de on 23 Jan 2011 at 8:48

GoogleCodeExporter commented 8 years ago
considered verified

Original comment by moo...@wwwendt.de on 17 Jul 2012 at 4:16

GoogleCodeExporter commented 8 years ago

Original comment by moo...@wwwendt.de on 17 Jul 2012 at 4:19