Jquery sortable not giving current sorted positions
I am using jquery sortable lib. The problem I am having is that
$(this).sortable('serialize')
not giving the current item position after sorting it in UI. Can anyone look into this jsbin example
and help me to figure out what is wrong?
HTML
- <div class="wrapper">
- <p id="foo_1"><div><span>foo</span>1000</div></p>
- <p id="foo_2"><div><span>foo</span>2000</div></p>
- <p id="foo_3"><div><span>foo</span>3000</div></p>
- <p id="foo_4"><div><span>foo</span>5000</div></p>
- </div
JS
- $(function() {
- $(".wrapper").sortable({
- update: function(e, ui) {
- console.log($(this).sortable('serialize'));
- console.log($(this).sortable( "toArray" ));
- }
- });
- });
Whatever way I arrange the UI, I get always "foo[]=1&foo[]=2&foo[]=3&foo[]=4" .