Sorry, i don`t have a working somaple online.. it`s all running on my
localhost. but i can tell you that IE is the biggest hell in cloning table
rows.. (i`m cloning them.. not showing/hiding)
but here is the javascript and the html for you:
// javascript:
function cloneObject(gdiv, insdiv, type)
{
var obj = document.getElementById(gdiv); //Div die gekloond wordt
var dest = document.getElementById(insdiv); //Div waar het nieuwe object
ingeplaatst wordt
var display = (type == 'table') ? 'table-row' : 'block';
var newObject = obj.cloneNode(true); //het object clonen
if ($.browser.mozilla || type != 'table')
{
newObject.style.display = 'none';
dest.appendChild(newObject);
$(newObject).show("slow", function() {$(this).css("display",
display)});
}
else if ($.browser.msie)
{
newObject.style.display = 'block'; //het object visible maken
return dest.appendChild(newObject); // het object toevoegen aan de
destination
}
else
{
dest.appendChild(newObject);
}
return newObject.style.display = display; //het object visible maken
}
function removeThisTR(obj)
{
return ($.browser.mozilla) ? $(obj.parentNode).hide("slow", function(){
obj.parentNode.parentNode.removeChild(obj.parentNode);}) :
obj.parentNode.parentNode.removeChild(obj.parentNode);
}
// html
<form method="post" action="admin.php
?act=settings&type=e_menu&go=go">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tbody id="insertHere2">
{ foreach value=item from=$menu_items }
<tr>
<td>
Name: <input type="text" name="name[]" value="{ $item.name
}" />
</td>
<td>
URL: <input type="text" name="url[]" value="{ $item.url }"
/>
</td>
<td>
Style: <input type="text" name="style[]" value="{
$item.custom_style }" />
</td>
<td>
Div ID: <input type="text" name="div_id[]" value="{
$item.div_id }" />
</td>
<td>
Order: <input type="text" name="order[]" value="{
$item.order }" /><img src="./templates/images/btn-close.gif" alt=""
title="Delete this row" style="border-style: none;"
onclick="removeThisTR(parentNode);" />
</td>
</tr>
{ /foreach }
</tbody>
</table>
<div style="text-align: center;">
<input type="button" onclick="cloneObject('getDiv2', 'insertHere2',
'table')" value="Add menu entry" name="clone" />
<input type="submit" value="Apply Changes" style="margin-top: 2ex;"
/>
</div>
</form>
<table>
<tr style="display:none;" id="getDiv2">
<td>
Name: <input type="text" name="name[]" />
</td>
<td>
URL: <input type="text" name="url[]" />
</td>
<td>
Style: <input type="text" name="style[]" />
</td>
<td>
Div ID: <input type="text" name="div_id[]" />
</td>
<td>
Order: <input type="text" name="order[]" value="0" /><img
src="./templates/images/btn-close.gif" alt="" title="Delete this row"
style="border-style: none;" onclick="removeThisTR(parentNode);" />
</td>
</tr>
</table>
---------
you will only need to add in the html tags, the jquery library and most
likely the interface library.
good luck :) and let me know what you think of it.
2007/2/26, Rick Faircloth <[EMAIL PROTECTED]>:
Hi, Mark…
I've been working with showing/hiding tables rows a little
and would like to see how your solution is working…got
a sample online that I can view?
Rick
*From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On
Behalf Of *Mark
*Sent:* Sunday, February 25, 2007 5:59 PM
*To:* jQuery Discussion.
*Subject:* Re: [jQuery] how do i use display: table-row; instrad of
display: block; with the show() effect on table rows?
Thanx that did the trick.
also importand to add is that a table MUST HAVE <tbody> and </tbody> :) if
you don`t have that it will get messy again :P
but thanx alot for fixing this issue.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/