Sortable: Using Table, OnEnd/OnUpdate return zero for new & old index

Created on 20 Aug 2016  路  1Comment  路  Source: SortableJS/Sortable

First of all, thanks for your great plugin.

I used your plugin with table, but onEnd & 'OnUpdate' event returned zero for newIndex & oldIndex.

I'm using latest version.

var el = $('.sortable > tbody')[0];
var sortable = Sortable.create(el, {
    handle: '.handle',
    ghostClass: 'ghost',
    chosenClass: 'chosen',
    animation: 150,
    onEnd: function (e) {
        console.log(e.oldIndex); // 0
        console.info(e.newIndex); // 0
        // for now I handled this issue like this
        console.log($(e.item).index());
    }
});

Most helpful comment

use dev branch,it's solve this problem
https://github.com/RubaXa/Sortable/tree/dev

>All comments

use dev branch,it's solve this problem
https://github.com/RubaXa/Sortable/tree/dev

Was this page helpful?
0 / 5 - 0 ratings