DIV around TR

S

soup_or_power

Hi
I've downloaded the script at
http://www.walterzorn.com/dragdrop/dragdrop_e.htm#config

for drag and drop feature. I tried enclosing <div></div> tags around
<table> so that the entire table can be dragged. However, it doesn't
work for individual rows. To give an example the following works:

<html>
<head>
</head>
<body>
<script type="text/javascript" src="wz_dragdrop.js"></script>

<div id="name1" style="position:absolute;">
<table border=1>
<TR><TD> Hello there </TD> <TD> how are you</TD></TR>
<TR><TD> hello3 </TD><TD>how are you 3</TD></TR>
</table>
</div>

<hr>
<div id="name2" style="position:absolute;">
<table id="name2" border=1>
<TR><TD> Hello there2 </TD> <TD> how are you2</TD></TR>
</table>
</div>
<div id="name3" style="position:absolute;"> hello there </div>
<script type="text/javascript">
<!--

SET_DHTML("name1", "name2", "name3");

//-->
</script>
</body>
</html>

However the following doesn't work:

<html>
<head>
</head>
<body>
<script type="text/javascript" src="wz_dragdrop.js"></script>


<table border=1>
<div id="name1" style="position:absolute;">
<TR><TD> Hello there </TD> <TD> how are you</TD></TR>
<TR><TD> hello3 </TD><TD>how are you 3</TD></TR>
</div>
</table>


<hr>
<table id="name2" border=1>
<div id="name2" style="position:absolute;">
<TR><TD> Hello there2 </TD> <TD> how are you2</TD></TR>
</div>
</table>

<div id="name3" style="position:absolute;"> hello there </div>
<script type="text/javascript">
<!--

SET_DHTML("name1", "name2", "name3");

//-->
</script>
</body>
</html>
~
 
W

web.dev

Hi Soup,

First of all, in javascript you can't move individual table rows. So
yes, your first example will work, but not the second. What you could
do is make a div element within the td element:

..
..
<td>
<div id = "name4">text</div>
</td>
..
..

Something like that. However, if you drag it, it'll stay within that
element. If you wanted to be able to separate that element, you're
gonna need to make the div element outside of the table.
 
D

Daniel Kirsch

web.dev said:
First of all, in javascript you can't move individual table rows.

why not?

document.onclick = function() {
var row1 = document.getElementById("one");
row1.parentNode.insertBefore(row1,null);
};

<table>
<tr id="one"><td>One</td></tr>
<tr id="two"><td>Two</td></tr>
<tr id="three"><td>Three</td></tr>
</table>

Daniel
 
E

Evertjan.

web.dev wrote on 17 jun 2005 in comp.lang.javascript:
First of all, in javascript you can't move individual table rows.

<table id=t>
<tr><td>World</td></tr>
<tr><td>Hello</td></tr>
</table>

<script type='text/javascript'>
var t = document.getElementById('t').firstChild
x=t.firstChild.cloneNode(true);
t.firstChild.removeNode(false);
t.appendChild(x)
</script>

Perhaps it can be done even simpler?
 
S

soup_or_power

Using the library I'm unable to move a table row <TR> if not a <TD>.
Someone please look into the code and let me know. Many thanks!
 
E

Evertjan.

wrote on 17 jun 2005 in comp.lang.javascript:
Using the library I'm unable to move a table row <TR> if not a <TD>.
Someone please look into the code and let me know. Many thanks!

please 1:
always quote on usenet, it's netiquettte.

please 2:
what library are you talking about?
 
S

soup_or_power

Evertjan. said:
wrote on 17 jun 2005 in comp.lang.javascript:


please 1:
always quote on usenet, it's netiquettte.

please 2:
what library are you talking about?

I was referring to Walter Zorn's library. Anyway, could you tell me how
to save the drag and drop changes to a database?
Thank you
 
E

Evertjan.

wrote on 17 jun 2005 in comp.lang.javascript:
I was referring to Walter Zorn's library.

I am not familiar with that.
Anyway, could you tell me how
to save the drag and drop changes to a database?

You would need to do that by serverside form-submission, methinks.

What is your serverside platform?
 
S

soup_or_power

Evertjan. said:
wrote on 17 jun 2005 in comp.lang.javascript:


I am not familiar with that.


You would need to do that by serverside form-submission, methinks.

What is your serverside platform?

It's perl/apache. I was thinking the DOM could be retrieved and saved
to
a DB LOB field. Is it possible? Thanks!
 
W

web.dev

Ah, I apologize for not being clear. Evertjan, yes you are correct,
you can indeed move elements that way. But, what soup wants to do is a
drag and drop functionality using that library. Therefore, there is no
way to move table row elements.
 
E

Evertjan.

wrote on 17 jun 2005 in comp.lang.javascript:
It's perl/apache.

Not my kind of soup. I'm into asping.
I was thinking the DOM could be retrieved and saved

Retrieving the DOM?
Isn't the DOM is a clientside dynamic structure,
dependent on the type of browser?
to a DB LOB field. Is it possible? Thanks!

See above. Don't know nothing avout lobbing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top