I would like to add support for sorting to tables I have created.
The placeholder I have implemented does not work at all in IE 7 when using item:TR . It works OK in FF.
I have tried the code on <UL\>
and it performs correctly. It seems to be specific to tables and
I have researched through forums, and it appears that not a lot of people are using sorting with tables:
<style type="text/css">
.dndPlaceHolder
{
background-color:Red ;
color:Red;
height: 20px;
line-height:30px;
border: solid 2px black;
}
.dndItem
{
background-color: #c0c0c0;
border:solid 1px black;
padding:5px;
}
</style>
<script type="text/javascript" >
$(function() {
$("#myTable").sortable(
{
placeholder:'dndPlaceHolder',
distance:15,
items:'tr',
forcePlaceholderSize:true,
change : dndChange,
update : dndUpdate
});
$("#myTable").disableSelection();
$("#myList").sortable(
{
placeholder:'dndPlaceHolder',
distance:15,
items:'li',
forcePlaceholderSize:true,
change : dndChange,
update : dndUpdate
});
$("#myList").disableSelection();
});
function dndChange(event,ui){
}
function dndUpdate(event,ui){
var msg = '';
}
</script>
<table id='myTable' >
<tr class='dndItem' id='1'>
<td>0 Active - Active</td>
</tr>
<tr class='dndItem' id='2'>
<td>1 Closed - Closed</td>
</tr>
<tr class='dndItem' id='3'>
<td>2 OnHold - On Hold</td>
</tr>
<tr class='dndItem' id='4'>
<td>3 Pending - Pending</td>
</tr>
</table>
<BR>
<UL id='myList' >
<li class='dndItem' id='1'>0 Active - Active</li>
<li class='dndItem' id='2'>1 Closed - Closed</li>
<li class='dndItem' id='3'>2 OnHold - On Hold</li>
<li class='dndItem' id='4'>3 Pending - Pending</li>
</ul>
Can you help me with my requirements using the code I have provided or refer me to a guide demonstrating how this is done?
Try this:
$("#myTable").sortable({
...
'start': function (event, ui) {
ui.placeholder.html('<!--[if IE]><td> </td><![endif]-->');
},
...
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With