<div dir="ltr">Hi Nik,<div><br></div><div>I'm glad you like the widgets and thank you for the feedback.  I encountered the same problem when implementing a D3.js widget (see <a href="https://github.com/jdfreder/ipython-d3">https://github.com/jdfreder/ipython-d3</a>).  As a hack-ish workaround I used a timeout with a 0ms interval (<a href="https://github.com/jdfreder/ipython-d3/blob/master/widget_forcedirectedgraph.js#L13">https://github.com/jdfreder/ipython-d3/blob/master/widget_forcedirectedgraph.js#L13</a>).  Right now I don't believe we have a nice way to do this, adding an event or method is probably a good idea.</div>
<div><br></div><div>-Jon</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Mar 14, 2014 at 11:27 AM, Nikolas Tezak <span dir="ltr"><<a href="mailto:ntezak@stanford.edu" target="_blank">ntezak@stanford.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi everybody,<br>
<br>
first of all, I _love_ the widgets, they are extremely useful!! And I’m super impressed by IPython’s crazy fast development progress.<br>
I am currently trying to create a custom widget type that embeds a jsplumb circuit editor<br>
( <a href="http://jsplumbtoolkit.com/demo/home/jquery.html" target="_blank">http://jsplumbtoolkit.com/demo/home/jquery.html</a> )<br>
<br>
However, when I implement my custom “render” method for the view I am running into a problem.<br>
I first dynamically create the circuit components (currently just absolutely positioned divs within the widget view’s this.$el div. This works fine.<br>
I then initialize a jsplumb instance and pass this.$el as the default container.<br>
Now, however, when I try to add the connectors and connections with jsplumb within the render method, it fails because jsplumb is trying to read out dynamically the position of the widget view’s div before that div has been inserted into the DOM.<br>

<br>
So basically, my problem is that I want code within “render()” that already requires the view to be inserted into the document.<br>
Should I use a different approach, i.e., maybe put this initialization code into "update()”, or do you expect that this will be a common enough use case that it would justify adding a special post render hook that gets called after the view’s div has been attached to a cell's widget sub_area?<br>

<br>
<br>
I hope I described this well enough, let me know if you’d like me to share a code example.<br>
Thanks,<br>
<br>
Nik<br>
_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</blockquote></div><br></div>