What do i have to do to make "details.drop" equals true in colReorder plugin?

What do i have to do to make "details.drop" equals true in colReorder plugin?

gabodawngabodawn Posts: 3Questions: 1Answers: 1

Hi:
My name is Gabriel. i will explain my problem.
i tried a lot of things, but this property always arrive with 'False'.

this is the documentation for the event.
https://datatables.net/reference/event/column-reorder

i just want to save the order of the columns (part of my code), when the reorder is finished.

for now i just save when 1.5 seconds has passed. after the last "column-reorder.dt" event is triggered.

This is my code:

var timerMovementColumns;
        $("#trList").on("column-reorder.dt", function ( e, settings, details ) {
            clearTimeout(timerMovementColumns);
            timerMovementColumns= setTimeout( function () {
                                                        SaveOrderColumns(CreateObj_Columns(),'@Url.Action("Create","ColumnsList")');
                                                    }, 1500 );
        });
    });

but i really want to save when the drop is finished.
Any suggestion?

By the way the library and the plugins are great, thanks you guys!

Sorry for my bad english. i hope you can understand the question.
I'm Chilean. viva chile mierda!

Answers

  • gabodawngabodawn Posts: 3Questions: 1Answers: 1
    edited January 2016

    Dear friends, finally i could get details.drop equals TRUE.

    i have to initialize DataTables with realtime : false like this:

    $("#trList").DataTable({
        colReorder: { fixedColumnsLeft: 1, realtime: false },
        searching: false,
        paging: false,
        info: false,
        ordering: false
    });
    

    so now i'm saving like this:

    $("#trList").on("column-reorder.dt", function ( e, settings, details ) {
        if (details.drop === true){
            //User ended sorting columns
            SaveOrderColumns(CreateObj_Columns(),'@Url.Action("Create","ColumnsList")');
        }
    });
    

    Now when is reordering columns the list doesn't move on realtime, it moves when you finished moving the columns (release the click button), but i can live with that. ha ha ha

    I hope this help other users.

    Thank you.
    Goodbye.
    Gabriel.

This discussion has been closed.