Hi, I am new in Jquery. I want to use sortableUI to my datalist. Each row in datalist contains text with serial number. I have used sortable ui successfully. But now I want move the text not the serial number while sorting. Here is my Example Code. The div displays the serial number at the top-left corner of each li. Now If I try to strat dragging for instance 2nd Li with 3rd li then 3rd item goes to 2nd position as rule but problem is that it goes after 2nd item's div (where it should be before div like first load). As a result, according to div's style.. serial no 1 and 2 overlap at 1st item's position.
Is there any way i could use to keep the div just after it's corresponding li while sorting?
<ul id="ulSortable" class="ui-sortable" >
<li class="Decide_Rank_Item_Li">test A</li>
<div class="DisplayOrder">1</div>
<li class="Decide_Rank_Item_Li">Test B</li>
<div class="DisplayOrder">2</div>
<li class="Decide_Rank_Item_Li">Test C</li>
<div class="DisplayOrder">3</div>
<li class="Decide_Rank_Item_Li">Test D</li>
<div class="DisplayOrder">4</div>
</ul>
Image Before sorting:
Now if I start moving a slight, u can see the div containing serial no still shows at right place
After sorting 2nd item to 3rd
<ul id="ulSortable" class="ui-sortable" >
<li class="Decide_Rank_Item_Li">test A</li>
<div class="DisplayOrder">1</div>
<div class="DisplayOrder">2</div>
<li class="Decide_Rank_Item_Li">Test C</li>
<li class="Decide_Rank_Item_Li">Test B</li>
<div class="DisplayOrder">3</div>
<li class="Decide_Rank_Item_Li">Test D</li>
<div class="DisplayOrder">4</div>
</ul>
Image after sorting:
Can't see image
The style of Li and Div are shown here Style:
.Decide_Rank_Item_Li
{
position: relative;
display: block;
border-color: #C0C0C0;
border-width: 1px;
border-style: solid;
vertical-align: bottom;
width: 110px;
height: 100px;
float:left;
background-color: #F8F8F8;
}
.DisplayOrder
{
position: relative;
display: block;
float: left;
top: 5px;
left: -105px;
z-index: 100;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
padding: 0px;
margin: 0px;
width: 0px;
clear: right;
color: #808080;
}