Hareeshchandera / jsplumb

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

Use enclosing table element as container if endpoint added to a table row or table cell. #158

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

jsPlumb attaches the elements it creates to the parent of the source endpoint 
in a connection.  For most cases this setup works ok, but if an endpoint is 
added to a td, this will be a tr element, which browsers do not like.

the solution is to use the enclosing table element if an endpoint was added to 
a td.

Original issue reported on code.google.com by simon.po...@gmail.com on 26 Dec 2011 at 9:55

GoogleCodeExporter commented 8 years ago
fixed in 1.3.4

Original comment by simon.po...@gmail.com on 26 Dec 2011 at 10:49

GoogleCodeExporter commented 8 years ago

Original comment by simon.po...@gmail.com on 26 Dec 2011 at 10:50

GoogleCodeExporter commented 8 years ago
1.3.4 was released today.

Original comment by simon.po...@gmail.com on 9 Jan 2012 at 6:59

GoogleCodeExporter commented 8 years ago
I've been connecting table rows together with jsPlumb 1.3.4 (after seeing your 
suggestion of not connecting <td>s).  Looks pretty good on Safari and Firefox, 
but IE 8 seems to ignore my connections (and some earlier versions of IE 
crash).  Looking at the generated HTML source, the jsPlumb code seems to be 
putting it's graphics at the end of <tbody> (which seems like the expected 
behavior).  Is the resulting IE behavior known? Expected? 

Original comment by s...@theworld.com on 18 Jan 2012 at 9:37

GoogleCodeExporter commented 8 years ago
you should not connect together table rows.  can you direct me to my comment 
about connecting table cells? are you referring just to my first comment on 
this issue?

Original comment by simon.po...@gmail.com on 18 Jan 2012 at 9:44

GoogleCodeExporter commented 8 years ago
..oh and the more i think about this the more i think that jsplumb doing 
anything about figuring out a more appropriate container element is a waste of 
time.  the problem will be that when it comes time to join two endpoints 
together, their display elements will not be children of the same parent, and 
you could end up with paint issues.

what you should do is decide on a common element to which you want jsplumb to 
attach elements, and either set it on the defaults:

jsPlumb.Defaults.Container = "some id or a selector"

or on each of the addEndpoint/connect calls:

jsPlumb.addEndpoint("somewhere", {
  container:"some id or a selector"
  ..other params..
});

Original comment by simon.po...@gmail.com on 18 Jan 2012 at 10:23

GoogleCodeExporter commented 8 years ago
Yes, I was referring to your first comment.

I'm not sure I understand your comment about not connecting table rows 
together.  As you suggested, I gave jsPlumb a default container (of "body"), 
and sure enough, now everything is being placed at the end of the body.  More 
importantly, IE 8 now works!  So now IE 8, Firefox 3.6, and Safari 5.1 all 
work.  I'm still using source: and destination: which are table row IDs.  Are 
you saying I shouldn't be doing this?

Original comment by s...@theworld.com on 18 Jan 2012 at 11:09

GoogleCodeExporter commented 8 years ago
what you are doing now is fine - sorry if i wasn't clear.  the "container" is 
used, if set either on an addEndpoint/connect call or on the defaults as you 
are now doing.  otherwise jsPlumb tries to figure out a suitable element to 
hang its stuff off, and that element is usually the parent of the endpoint (or 
of the source endpoint when adding a connection).  

this parent of the endpoint thing works fine for many situations, but when 
you're attaching stuff to elements that are nested deeper in the DOM, such as 
happens for stuff inside tables (or in lots of other situations of course), you 
end up in a situation where jsPlumb has attached its stuff to various different 
parents, and then you run the risk of coordinate systems clashing and things 
being out of place.

in short, it's best practise to identify some element to which everything 
should be attached, and set it as the default container. so you're all good.  

as long as the location and dimensions of the TR elements are being reported 
correctly by whatever library you're using, it's cool to add things to them.  i 
am wary of anything to do with tables, i guess, having been stung by various 
browsers over the years.  

Original comment by simon.po...@gmail.com on 18 Jan 2012 at 11:18

GoogleCodeExporter commented 8 years ago
Many thanks.  I've having a good time using your software.

Original comment by s...@theworld.com on 18 Jan 2012 at 11:31

GoogleCodeExporter commented 8 years ago
you're welcome.  

Original comment by simon.po...@gmail.com on 18 Jan 2012 at 11:55

GoogleCodeExporter commented 8 years ago
Can you tell me how to connect table rows together?

Original comment by m...@mrnepal.com on 17 Jan 2013 at 7:56