RowReorder on server confirmation

RowReorder on server confirmation

vetezeveteze Posts: 6Questions: 1Answers: 0

I'm using rowreorder like this:

rowReorder: {
    dataSrc: 1,
    update: true,
    selector: '.sortGridRow'
},

.on('row-reorder', function (e, diff, edit) {
    var updatedIds = [];
    var updatePositions = [];

    for (var i = 0, ien = diff.length; i < ien ; i++) {
        updatedIds.push(diff[i].node.id.substring(8));
        updatePositions.push(diff[i].newPosition);
    }

    ServerSideCallToUpdateRows(updatedIds, updatePositions, function(result) {
        if(result) {
            //NOW RESET ORDERING IN DATATABLE
        }
    });         
})

I'd like to lock the interface or only do the datatable update once the server has responded with a confirmation. Is there a way I can do this?

Thanks!

Replies

  • allanallan Posts: 63,572Questions: 1Answers: 10,482 Site admin

    Unfortunately no. row-reorder is a simple notification that something has happened only - there is no way to "pause" the execution using the event handler. Sorry.

    Allan

  • vetezeveteze Posts: 6Questions: 1Answers: 0

    yeah "pause"ing wouldn't be a sexy at all. a callback of some kind would make more sense. or a way for me to send a reference to my server call in as a rowReorder param

    rowReorder: {
        dataSrc: 1,
        update: true,
        selector: '.sortGridRow',
        updateCallback: function(a, b) { return true; }
    },
    

    in rowReorder you call updateCallback and wait for a response back before doing the table re draws.

  • vetezeveteze Posts: 6Questions: 1Answers: 0

    or a table.disable() / .enable()

This discussion has been closed.